Author: Sune Fischer
Date: 16:37:22 03/29/03
Go up one level in this thread
On March 29, 2003 at 14:16:15, Russell Reagan wrote:
>This will return the location of the least significant bit. Dieter helped me
>with this one some time ago. The syntax that GCC uses for inline assembly is
>AT&T syntax I believe, as opposed to the Intel syntax, which is what MSVC uses.
>I'm not sure if this is the most optimal way to do it, but it worked for me, and
>I figure that Dieter knows this stuff way better than me :)
>
>int LowBit (Bitboard b) {
> int result;
> __asm__ volatile ("
> movl $-33, %0
> bsfl %2, %0
> addl $32, %0
> bsfl %1, %0"
> : "=q" (result)
> : "g" ((unsigned long)b), "g" ((unsigned long)(b>>32))
> : "cc" );
> return result;
>}
Hmm, I get warnings:
"bits.h:117:27: warning: multi-line string literals are deprecated"
-S.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.