Quote Originally Posted by IceDane View Post
Ah, I didn't know that, actually. Does GCC do that, by default? Or do you need to use optimization switches?
If you don't give any optimization switch, I believe gcc does -O1, which is "midle and gentle optimization".

And under these conditions, it will definitely replace divide by shift when possible [I just tried it].

If you write a little piece of code to test it, use -S to get gcc to give you assembler output, and you should see what it does.

--
Mats