by askvictor · 8y ago · 0 comments
The rest aren't hacks, they're bit manipulations, which are crucial for those who need them, and just about useless to those who don't.
It only ever caught my attention that writing (n & 1) is weird when some TAs looking at my code didn't understand what I was doing during my first college year.
Though if this is a hack then checking the last digit to see if a decimal number is even is also a hack :)
When your processor doesn't have built-in integer division and the corresponding compiler doesn't optimize that and you need it to work fast.