分类:
2011-07-08 10:26:16
#include #include static long asm_bsr( const long x); int i = 0; printf("%d\n",asm_bsr(8)); return 0; } long asm_bsr( const long x){ long y = x; _asm { mov eax,y; //居然能敢这么干,让我感觉很惊奇 //mov ebx,[eax]; bsr eax,eax; mov y,eax; }; return y; } |
linux版本:
#include static long asm_bsr( const long x); int main(void){ printf("%d\n",asm_bsr( 8)); return 0 ; } long asm_bsr( const long x){ long y = x; __asm__( "bsr %0,%0\r\n" : "=r" (y) : "0" (y) ); return y; } |