Skip to content
All tags

#bitwise-operators

2 posts

Stanford CS107 Lecture 4: Bitwise Operators, Conversions, and Masks

Lecture 4 first shows that signed/unsigned conversion can preserve bits while changing meaning, that mixed comparisons may surprise, and how sign extension, zero extension, and truncation alter width. It then derives AND, OR, NOT, XOR, and bitmask idioms for testing, setting, clearing, and combining fields.

Stanford CS107 Lecture 5: Bit Shifts, Bit Tricks, and GDB

Lecture 5 extends masks to shifts, power-of-two and popcount tricks, then uses an absolute-value example to expose signed intermediate overflow at INT_MIN. Its second half establishes a GDB workflow around breakpoints, execution control, formatted printing, memory examination, and backtraces.