Created
March 15, 2015 14:32
-
-
Save ir4y/c1bcb7f10708192d14a1 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
| #include <stdio.h> | |
| void add(unsigned long long *dst, unsigned long long *src){ | |
| asm ("movq %0, %%rbx\n" | |
| /*"addq $8, %%rbx\n"*/ | |
| "movq (%%rbx), %%rax\n" | |
| "addq (%1), %%rax\n" | |
| "mov %%rax, (%%rbx)\n" | |
| /*"adcq $0, %%rax\n"*/ | |
| /*"addq $8, %%rbx\n"*/ | |
| /*"mov %%rax, (%%rbx)\n"*/ | |
| : /* No outputs. */ | |
| : "r" (dst), "r" (src) | |
| : "rax", "rbx"); | |
| } | |
| int main(){ | |
| unsigned long long a[3], b[3]; | |
| a[0]=1; | |
| a[1]=-1; | |
| a[2]=0; | |
| b[0]=1; | |
| b[1]=1; | |
| b[2]=0; | |
| add(a,b); | |
| printf("%x %x %x\n",a[0],a[1],a[2]); | |
| printf("%x %x %x\n",b[0],b[1],b[2]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment