This tutorial teaches binary representation, bitwise operators, and
common bit-manipulation patterns; covering topics from first principles to real-world
applications including floating-point binary formats commonly used in machine
learning.
Every concept and learning block is supported by hands-on interactive demos.
The tutorial consists of 10 chapters.
The first 6 chapters provide foundational knowledge and should be read sequentially.
The remaining 4 chapters give examples of applications of foundational techniques and
can be consulted without any particular order.
Foundations
Chapter 1
Binary Place Values
How bits combine to represent any whole number.
Chapter 2
Signed Integers
Two's complement and the origin of negative numbers in binary.
Chapter 3
Bitwise Operators
AND, OR, XOR, and NOT applied bit-by-bit.
Chapter 4
Bit Shifts
Logical and arithmetic shifts as multiplication by powers of two.
Chapter 5
Bit Masks
Building and applying single-bit and range masks.
Coming soon
Chapter 6
Bit Tasks
Get, set, clear, toggle, and update individual bits.
Coming soon
Applications
Chapter 7
Bit Puzzles
XOR tricks, Hamming weight, and other classic bit-level problems.
Coming soon
Chapter 8
Packing and Unpacking
Storing multiple values in one integer using bit fields.
Coming soon
Chapter 9
Bit Patterns
Permissions, logâ‚‚, and other real-world bit patterns.
Coming soon
Chapter 10
Floating Point
IEEE 754 from sign bit to NaN, covering fp32, fp16, and bf16.
Coming soon