Y
Hacker News
new
|
ask
|
show
|
jobs
by
sammoth
3221 days ago
Don't the two bits of code have completely different behaviour? And the code with the bitshift is undefined on negative integers (in C). So the bottom code could indeed be the "correct way to do it".
1 comments
biesnecker
3220 days ago
Fair, with negative ints they're different. They have the same behavior on positive ints, though.
link