-
asm bsf statement
has anybody here used the assembly statement bsf?
I am looking at optimizing my gravity and collision detection code, and I was thinking of using bsf to loop through my variables and find the first set bit.
but then I tried using bsf in just a little sample piece of code and I could not get it to work using inline assembler. Has anybody in here used it before? I would like to see its usage in inline asm...
-
No, but you may need to state the compiler you're using as they all seem to handle inline asm slightly differently. This works on MSVC -
Code:
#include <iostream>
using namespace std;
int main()
{
int a = 4,b=0;
_asm {
bsf eax,a
mov b,eax
}
cout << b;
return 0;
}