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

immediate encoding

How a constant is squeezed into the few bits an instruction has room for, which is why some constants fit in one instruction and others don't.

Immediate encoding is the scheme an ISA uses to store a constant in an instruction's immediate field: RISC-V splits a sign-extended 12-bit value across fields, ARM64 uses 12-bit values (optionally shifted by 12), 16-bit chunks for movz/movk and bitmask immediates for logical instructions, and x86-64 stores 1, 2, 4 or 8 whole bytes.

Examples

  • RISC-V addi holds −2048 to 2047, so the assembler rejects addi a0, a0, 2048.

Read the full section →