Thanks, Marc, you are definitely faster than I am. I'm working on testing this.
The R6RS definition of fxfirst-bit-set says that (fxfirst-bit-set 0) => -1, so do you want
[brad:~/programs/gambc-4.0b18/include] lucier% rcsdiff -u gambit.h =================================================================== RCS file: RCS/gambit.h,v retrieving revision 1.2 diff -u -r1.2 gambit.h --- gambit.h 2006/09/23 16:28:13 1.2 +++ gambit.h 2006/09/23 16:28:44 @@ -2567,7 +2567,7 @@ ___BITCOUNT_TEMP()) #define ___FIXFIRSTBITSET(x) \ (((___temp=(x))==0) \ -?___FAL \ + ?___FIX(-1) \ :(___temp=(___temp&-___temp), \ ___FIX((((___temp&~___SCMOBJ_MASK(0x55555555,0x55555555))!=0)| \ (((___temp&~___SCMOBJ_MASK(0x33333333,0x33333333))!=0) <<1)| \ @@ -2598,7 +2598,7 @@ ___BITCOUNT_TEMP()) #define ___FIXFIRSTBITSET(x) \ (((___temp=(x))==0) \ -?___FAL \ + ?___FIX(-1) \ :(___temp=(___temp&-___temp), \ ___FIX((((___temp&~___SCMOBJ_MASK(0x55555555,0x55555555))!=0)| \ (((___temp&~___SCMOBJ_MASK(0x33333333,0x33333333))!=0) <<1)| \