Add 64 bit FindFirstBit function
This commit is contained in:
@@ -55,6 +55,13 @@ uint8 FindFirstBit(uint32 x)
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8 FindFirstBit64(uint64 x)
|
||||||
|
{
|
||||||
|
if (x == 0) return 0;
|
||||||
|
if ((x & 0x00000000ffffffffULL) != 0) return FindFirstBit(x);
|
||||||
|
return FindFirstBit(x >> 32) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -198,6 +198,13 @@ inline uint8 FindFirstBit(uint32 x)
|
|||||||
return __builtin_ctz(x);
|
return __builtin_ctz(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint8 FindFirstBit64(uint64 x)
|
||||||
|
{
|
||||||
|
if (x == 0) return 0;
|
||||||
|
|
||||||
|
return __builtin_ctzll(x);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/** Lookup table to check which bit is set in a 6 bit variable */
|
/** Lookup table to check which bit is set in a 6 bit variable */
|
||||||
|
Reference in New Issue
Block a user