Tags: , , , , , , ,

Many programmers are aware of a special case where you can use a bitwise shift for multiplication or division when you’re multiplying or dividing by a power of two. For example, you can replace i * 2 with i < < 1 and i / 2 with i >> 1. A lesser-known trick works for modulus. But are these alternatives actually any faster? Today’s article puts them to the test!

Read the rest of this article »

8 Comments