Merge pull request #144 from Sonicadvance1/fix-BitScanFoward

Fix the BitScanForward implementations for x86_64.
This commit is contained in:
sudonim1 2014-07-30 18:19:19 +01:00
commit 904f5de1ea
2 changed files with 2 additions and 2 deletions

View File

@ -591,7 +591,7 @@ static __inline__ __attribute__((always_inline)) void __addfsdword(const unsigne
/*** Bit manipulation ***/ /*** Bit manipulation ***/
static __inline__ __attribute__((always_inline)) unsigned char _BitScanForward(unsigned long * const Index, const unsigned long Mask) static __inline__ __attribute__((always_inline)) unsigned char _BitScanForward(unsigned long * const Index, const unsigned long Mask)
{ {
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask)); __asm__("bsfl %k[Mask], %k[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
return Mask ? 1 : 0; return Mask ? 1 : 0;
} }

View File

@ -374,7 +374,7 @@ struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_fr
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask) __forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
{ {
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask)); __asm__("bsfl %k[Mask], %k[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
return Mask ? 1 : 0; return Mask ? 1 : 0;
} }