Skip to content

Instantly share code, notes, and snippets.

@jxu
Last active May 4, 2025 19:48
Show Gist options
  • Save jxu/a8eeff7a8c59a54aee5ce69223d29064 to your computer and use it in GitHub Desktop.
Save jxu/a8eeff7a8c59a54aee5ce69223d29064 to your computer and use it in GitHub Desktop.
f(std::vector<bool, std::allocator<bool>> const&, unsigned long):
mov rax, rdi ; rax = v
mov rdi, rsi ; rdi = i
mov ecx, esi ; rcx = i
mov rdx, QWORD PTR [rax] ; rdx = *v
shr rdi, 6 ; rdi >>= 6
mov eax, 1 ; rax = 1
sal rax, cl ; rax <<= (rcx & 0xFF)
and rax, QWORD PTR [rdx+rdi*8] ; rax &= rdx[rdi]
setne al ; al = (rax != 0)
ret
; rax = (1 << (i & 0xFF)) & v[i >> 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment