With my version of GCC, the shifting implementation creates five instructions, all operate on registers only. The other implementation also creates five instructions, but introduces one jump and one memory access. But, you are right, being readable is also important. Maybe we can tweak it a little or create something similar to those in bitops.Usually, the compiler is better at making code efficient than humans. I
find that coding it in the most human-readable way is best unless I
*know* the compiler is unable to generate god code.
"good code", even.
I really want a "god code" compiler, though. :)