The manipulation of individual bits. Operators used may include bitwise AND, OR, XOR, NOT, left-shift, and right-shift.

The manipulation of individual bits. Operators used may include bitwise AND (`&`

), OR (`|`

), XOR (`^`

), NOT (`~`

), left-shift (`<<`

), and right-shift (`>>`

).

A blog article, Introduction to Low Level Bit Hacks, starts with basics like `x |= 1<<n`

for setting a bit, then breaks down interesting ones like `y = x & (x-1)`

to clear the rightmost set bit (like x86 `blsr`

), with detailed examples showing binary values of intermediates.

Sean Anderson has a large collection of problems which can be solved efficiently by bitwise operations; the collection can be found here.

Alan Mycroft has a somewhat smaller collection of (mostly bit-twiddling) programming hacks, mostly transposed from HAKMEM. It's available here.