Why doesn't Arduino 1.0.1 use the latest GCC?

stimmer:
In any case it would only be useful for the fairly rare case of shifting an unsigned byte by 4 places.

It might be a bit too much to expect the compiler to know when it can use a swap - I wouldn't expect it to get x=(x>>4)|(x<<4); down to a single swap! :slight_smile:

Actually, I believe the latest version does in fact optimize x=(x>>4)|(x<<4); down to a single swap. I saw someone use that in an example over on avrfreaks and show the assembly that was generated.

And swap isn't only useful for shifting an unsigned byte 4 places. It's also useful for shifting unsigned ints and longs. After all, if you want to shift those right by 4, then every byte in them needs to be shifted right by 4.