Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: