Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

zeroing idiom

Setting a register to zero with xor eax, eax instead of mov eax, 0, because it is shorter.

xor eax, eax (2 bytes, versus 5 for mov eax, 0) zeroes rax, and processors recognize it as independent of rax's old value; it also clears CF and OF and sets ZF.

Examples

  • xor eax, eax sets eax, and so all of rax, to 0 in 2 bytes, shorter than mov eax, 0.

Read the full section →