【发布时间】:2013-01-24 05:51:48
【问题描述】:
由于我对 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;"
);
但是mov $src1, %eax; 不起作用。
有人可以提出解决方案吗?
【问题讨论】: