gcc question for inline assembly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi - someone supplied the following code
in a C++ program to me that g++ compiled.

However, I want to convert it to use it in
a regular C program that gcc can compile.

Needless to say, the construct does not work
for GNU C.

I've tried placing each line of the assembly
in asm("...."); and that also fails to get
gcc to compile it.

What would the equivalent GNU C function for the
below be?

static unsigned int bitScanAndReset(unsigned long long & bb) {

      __asm
      {
              xor     edx, edx
              mov     ebx, [bb]
              xor     eax, eax
              inc     edx
              bsf     ecx, [ebx]
              jnz     found
              bsf     ecx, [ebx+4]
              lea     ebx, [ebx+4]
              xor     eax, 32
      found:
              shl     edx, cl
              xor     eax, ecx
              xor     [ebx], edx
      }
}

Thanks,

Stuart



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux