Tip of the week#5: Fast multiplication
It is well known that bit shifting enables programmers to do multiplication when dealing with numbers such as 2, 4, 8, 16, 32, 2^n, …
For instance:
a=a<<4;
equals
a*=16;
But multiplying by 100 (and for many other numbers) is also possible:
a*=100;
equals
a= a*64 + a*32 + a*4;
equals
a=(a<<6)+(a<<5)+(a<<2);
Some compilers might optimise this by themselves.