Sean Anderson's Bit Twiddling Hacks (bit manipulation tricks in C) in one file, with 14 bugs fixed and 6 faster versions. Popcount, parity, log2, bit reversal, Morton codes and more.
c performance algorithms bit-manipulation parity bitwise bitwise-operators popcount undefined-behavior bit-twiddling hamming-weight morton-code bit-reversal swar de-bruijn-sequence bit-hacks z-order-curve bithacks count-trailing-zeros integer-log2
-
Updated
Nov 4, 2026