3 ms·
That depends on the CPU used. Modern CPU have more arithmetic units than logical units and can perform more divisions than bit shifts. There was a good video pr
by feb 15y ago
That depends on the CPU used. Modern CPU have more arithmetic units than logical units and can perform more divisions than bit shifts. There was a good video presentation of that, but
I can't find the link now.
EDIT: http://blogs.msdn.com/b/shawnhar/archive/2007/03/19/a-story-about-premature-optimization.aspx http://blogs.msdn.com/b/shawnhar/archive/2007/03/19/a-story-... gives other reasons why multiplications can be faster than bit shifts.
- aidenn0 15y agoThat's multiplies, not divides. Modern CPUs are still faster at shifts than divides, even the pentium4, which lacked a single-cycle shift unit.