>> >    paletteTemp[0] = *(paletteGet+0);
>>  paletteTemp[0] = paletteGet[0];
>
> From experience the top-most is faster.  Dereferencing something 
> using var[n] makes the compiler add different steps than *(var+n).  
> If I was to optomize this more, I'd turn the lefthand side into 
> pointer references as well...

this is soley up to the compiler.

  paletteTmp[0] = *paletteGet;
  paletteTmp[0] = paletteGet[0];

a good compiler would make this like this in assembly:

  move.b  (%a0), %d0
  move.b  %d0, (%a1)

if the compiler knows the side of the array buffer, it can also
optimize:

  paletteTmp[0] = *(paletteGet + 5);
  paletteTmp[0] = paletteGet[5];

as:

  move.b  5(%a0), %d0
  move.b  %d0, (%a1)

compilers are not so smart, if your dealing with pointers, try to
use *ptr as much as possible as compared to using ptr[] with an 
offset. compilers normally take [] and do a multiplication to 
determine the offset. :)

---
Aaron Ardiri                             [EMAIL PROTECTED]
CEO - CTO                                                +46 70 656 1143
Mobile Wizardry                           http://www.mobilewizardry.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to