Skip to content
BytePatterns

Bit Manipulation

Flip, mask and shift — the tricks that turn a loop into one instruction.

Bit Manipulation progress0 / 5
  1. Binary and Bitwise OpsEvery integer is a row of switches you can address.4m
  2. XOR TricksPairs cancel out, and the loner is left standing.4m
  3. Counting Set BitsClear the lowest 1 and count how often you can.4m
  4. Masks and Power of TwoOne shifted bit is a key to any position you like.5m
  5. Bitmask as a SetAn integer is a subset; counting to 2^n lists them all.5m

Quiz yourself: 3 questions from this module

1 / 3

What is `13 & 6`?