dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: arrays & pointers

Re: arrays & pointers

From: BlueChip <>
Date: 2005-01-04

At 22:51 03/01/2005, you wrote:
>Wow. What compiler are you using?

afaik, the same version as the other RockBox devs ...In fact, when I
created the RockBox DevKit v3 I recall including a more recent version of
the sh-1 gcc (recalled due to a problem it caused when it over-optimised
the grey-scale lib functions) ...I know that at least two core devs
followed me in the upgrade (obviously one of those being Jens) - so I guess
we are all having the same problems.

And yes, I agree, the compiler SHOULD be doing that - but I have to date
found several major bugs in gcc, so oversights such as optimising array
access really doesn't surprise me.


> This looks like an easy compiler optimisation to me, so I'd be amazed
> that you'd need to manually do something like this (i.e. put the pointer
> into a local variable and do accesses through that rather than
> dereference the array more than once). I mean, seriously, this is what
> compilers are *for*.
>----- Original Message ----- From: "BlueChip" <>
>To: "Rockbox development" <>
>Sent: Monday, January 03, 2005 8:34 PM
>Subject: arrays & pointers
>>Just saw this go in...
>>Log Message:
>>using a pointer instead of array dereferencing saves ~250 bytes
>> From my work on the card games library ...I discovered that arrays are
>> probably THE most expensive thing for our compiler. If you are going to
>> reference an element in array even just twice, it is memory efficient to
>> create a pointer to that element and use the pointer instead.
>>Given the _excessive_ efficiency of it, I guess it is also faster as well!
>>If you're going to access the pointer several times, you might even like
>>to stick a "register" in front of it for extra speed :)

Received on Tue Jan 4 00:30:12 2005

Page was last modified "Jan 10 2012" The Rockbox Crew