3 ms·
The "shifting" vs "multiplication" is just an optimisation since x * 2 == x << 1 for any positive x. As far as I'm aware shifting a negative number is undef
by Sean1708 9y ago
The "shifting" vs "multiplication" is just an optimisation since
x * 2 == x << 1
for any positive x. As far as I'm aware shifting a negative number is undefined, which will be why they use multiplication for negatives.