Bit shifts or multiplications

Started by
3 comments, last by jemts 20 years, 9 months ago
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
----Jemts"A Hooloovoo is a super-intelligent shade of the color blue."- Douglas Adams
Advertisement
It''s not worth it. Go for standard multiplication, which is more readable.
You will not notice a difference, and if the compiler is even half-smart it should do the conversion for you.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
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 .
thanks alot

----
Jemts
"A Hooloovoo is a super-intelligent shade of the color blue."- Douglas Adams
----Jemts"A Hooloovoo is a super-intelligent shade of the color blue."- Douglas Adams

This topic is closed to new replies.

Advertisement