Bit shifts or multiplications
I was wondering whether using bit shifts instead of multiplying or dividing by the power of 2^n is worth it. Will it improve performance at all and if so will it improve it enough to make using bit shift for this purpose worth wild.
----
Jemts
"A Hooloovoo is a super-intelligent shade of the color blue."- Douglas Adams
You will not notice a difference, and if the compiler is even half-smart it should do the conversion for you.
Yeah, any compiler will convert a multiplication that is a power of 2 and turn it into a shift anyways, find something better to optimize .
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement