由于我是GCC的新手,因此我遇到了内联汇编代码的问题.问题是我无法弄清楚如何将C变量(属于类型UINT32)的内容复制到寄存器中eax.我试过以下代码:
__asm__
(
// If the LSB of src is a 0, use ~src. Otherwise, use src.
"mov $src1, %eax;"
"and $1,%eax;"
"dec %eax;"
"xor $src2,%eax;"
// Find the number of zeros before the most significant one.
"mov $0x3F,%ecx;"
"bsr %eax, %eax;"
"cmove %ecx, %eax;"
"xor $0x1F,%eax;"
);
Run Code Online (Sandbox Code Playgroud)
但是mov $src1, %eax;不起作用.
有人可以建议解决这个问题吗?