VOOZH about

URL: https://qiita.com/ohisama@github/items/c152dd85f482901f25fb

⇱ paizaでインラインアセンブラ #GCC - Qiita


👁 Image
1

Go to list of users who liked

1

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

@ohisama@github

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));
}


成果物

以上。

1

Go to list of users who liked

1
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1

Go to list of users who liked

1