~/talk

Bit Twiddling, Duff's Device ... Extreme Code Optimizations

TalkinFrenchat BDX I/O 2026 · 2026-10-29..10-30· [c-and-cpp]
slides:none on file

Shows how low-level bit-manipulation techniques (bit twiddling) and clever loop-unrolling constructs like Duff's Device (Tom Duff, 1983) can implement certain operations without branches or loops. Explains the binary operations involved, gives examples of these extreme optimizations, and argues when and why they can still be useful with modern languages and runtimes.

AI-written summary · about

  1. 0:00Extreme optimizations intro
  2. 6:37Compiler Explorer overview
  3. 7:40Bit twiddling basics
  4. 11:31Round to power of two
  5. 15:05Absolute value no branches
  6. 19:38Sign extend 24-bit words
  7. 25:35Bit parity calculation
  8. 30:08Zero-byte detection SWAR
  9. 33:14Reverse bit order
  10. 35:20Duff's Device explained
  11. 45:10Summary and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.