paizaでインラインアセンブラ
1
Last updated at Posted at 2018-09-21
概要
x64で、インラインアセンブラやってみた。
サンプルコード
足し算。
# include <stdio.h>
int test(int a, int b)
{
int ret = 0;
__asm__ volatile ("add %1, %2; mov %2, %0;" : "=r" (ret) : "r" (a), "r" (b) : );
return ret;
}
int main(void)
{
int a = 100;
int b = 200;
printf ("%d", test(a, b));
}
成果物
以上。
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
