Hacker News new | ask | show | jobs
by RegEx 4756 days ago
I believe 0x80 is 0b1000000
1 comments

Oops, did everything in decimal. Good point and correction. Still, the difference in legibility and implications of the two lines of code are important. Modern compilers would optimize ((foo & 0x80) == 0x80) to (foo & 0x80) but leave ((foo & 0x60) == 0x60) alone because it is testing more than one bit.