Created
December 16, 2014 14:28
-
-
Save gofer/d6169c4907c25bde4f20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.align 8 | |
.text | |
.globl linux_fast_abs64 | |
linux_fast_abs64: | |
movq %rdi, %rax # rax <- x | |
sarq $63, %rax # rax <- rax >> 63 | |
xorq %rax, %rdi # rdi <- rdi ^ rax | |
subq %rax, %rdi # rdi <- rdi - rax | |
movq %rdi, %rax # rax <- rdi | |
retq | |
.globl windows_fast_abs64 | |
windows_fast_abs64: | |
movq %rcx, %rax # rax <- x | |
sarq $63, %rax # rax <- rax >> 63 | |
xorq %rax, %rcx # rcx <- rcx ^ rax | |
subq %rax, %rcx # rcx <- rcx - rax | |
movq %rcx, %rax # rax <- rcx | |
retq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment