Re: Shift / bitwise operators
> On shifting vs. multiplication, I once worked with a very interesting system where doing something like x*=2 was actually faster than x<<=1
I can only suggest to also always try the unoptimized code and see what the compiler makes of it. Many optimizations that were OK two decades ago are actively bad today.
I meanwhile stopped to do the shift-for-multiply stuff because the compiler outsmarts me as a rule. Compiler-writer-appreciation-pint ---->
With platforms/compilers where the optimizer is not so great things may well be different.