Hacker News new | ask | show | jobs
by biesnecker 3222 days ago
Did your coworker correct it with "this is more readable" or "this is the correct way to do it"? The first is arguable (though I don't personally agree with the argument), the second just betrays a real lack of knowledge.
1 comments

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".
Fair, with negative ints they're different. They have the same behavior on positive ints, though.