http://qs1969.pair.com?node_id=134493


in reply to Re: Help w/ Code Optimization
in thread Help w/ Code Optimization

Once upon a time, that was a good idea for PC's. On a 80486, where shift took 1 clock and multiply took up to 40, it was still faster sometimes. Note I said "up to" because it stops early, and essentially does this same thing internally--one addition for each '1' bit, using a barrel shifter that skips the zeros.

But with Pentium and later, the multiply is just as fast as anything else, and breaking it up into multiple steps makes it slower, by far.

—John