C++:BitHacks
lastmod 2026-11-10created 2018-11-132 edits
Bit hacks (bit tricks) are programming techniques that combine bitwise operators to finish a computation without conditionals or loops. Typical examples include checking for a power of two, counting set bits, isolating the lowest set bit, and branchless absolute value and minimum calculations; they are used in performance-critical code and embedded environments. Stanford's Bit Twiddling Hacks page is the most comprehensive collection of these techniques.
See also
Favorite site
- Bit Twiddling Hacks 1
- Google translate (en -> ko): Bit_Twiddling_Hacks_-_ko.pdf
References
-
Bit_Twiddling_Hacks.pdf ↩