News for hackers. Stuff that matters.
Re:Low Level Bit Hacks You Absolutely Must Know by pandaman on Friday May 11, 2018 @03:02AM (#17045458)
With many compilers (e.g. clang, msvc) this will emit actual division without optimization (and if the number is signed it's quite a lot of code). If such code is in the inner loops it can hit performance, which is already not great without the compiler's optimization. And if one ever looked for a bug that takes more than few seconds to reproduce then the debug build's performance cannot be over-valued.

Though if this is a hack then checking the last digit to see if a decimal number is even is also a hack :)

Re:Low Level Bit Hacks You Absolutely Must Know by slx26 on Friday May 11, 2018 @04:24AM (#17045737)
Which brings us to: knowing when to use bit hacks is as important as knowing how to implement them. And you usually want to know about compilers for that.