← Back to Interactive Learning

Bit-Shift Byte Extraction

Enter any 64-bit value, pick a target byte, and step through the shr / shl / shr sequence that extracts it — no AND allowed.

64-bit value
0x
Target byte (click to select)
Step 1 of 4
RDI  (source — never changes)
RAX  (working register)

The Formula — extracting byte BN from a 64-bit register

mov rax, rdi
; bring target to B0:
shr rax, N×8 ; N = byte index (0 = LSB)
; wipe everything above B0:
shl rax, 56 ; 56 = 64 − 8 → push B0 to B7
shr rax, 56 ; slide B7 back to B0
; result: rax = 0x00…00 [target byte]