Skip to content

Instantly share code, notes, and snippets.

@vtlmks
Created April 4, 2019 18:32
Show Gist options
  • Select an option

  • Save vtlmks/770b9cc0ebb99690928dfd7adb9ee5ab to your computer and use it in GitHub Desktop.

Select an option

Save vtlmks/770b9cc0ebb99690928dfd7adb9ee5ab to your computer and use it in GitHub Desktop.
memcmp Cld
Mov r10, rdi ; save
Mov r11, rsi ; save
Mov rdi, rcx
Mov rsi, rdx
Mov rcx, r8
Mov rdx, r8
Xor eax, eax
Cmpsb
Je .done
.not_equal: Mov al, [rdi-1] ; check the last bytes
Movzx ecx, byte [rsi-1]
Sub eax, ecx
.done Mov rdi, r10
Mov rsi, r11
Ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment