Scan a 32-bit integer to search for specific bits. This topic only applies to Intel® 64 and IA-32 architectures targeting Intel® Graphics Technology.
Description
These functions scan the 32-bit integer value to search for specific bits.
The following table shows the bit that each function seeks:
Function | Description |
---|---|
_fbh_i32 | Scans the signed integer value from bit 31 to bit 0, starting from bit 31, to find the first bit set to a 0 or 1. You can use this function to find how many significant binary digits you need to store value, plus one bit for the sign. You can use this function to find the power of 2 nearest to value. |
_fbh_u32 | Scans the unsigned integer value from bit 31 to bit 0, starting from bit 31, to find the first bit set to 0. |
_fbl | Scans the signed integer value from bit 0 to bit 31, starting from bit 0, to find the first bit set to a 1. |
Note
When value is 0xFFFFffff _fbh_i32 returns 0xFFFFFFFF, while _fbh_u32 returns 0.
Return Values
Function: _fbh_i32 | If the source operand type is positive, returns the count of leading zeros. If the operand is negative, returns the count of leading ones. If the source operand is equal to 0 or 0xFFFFFFFF, returns 0xFFFFFFFF. |
Function:_fbh_u32 | Returns the count of leading zeros. If the source operand is equal to 0, returns 0xFFFFFFFF. |
Function:_fbl |
Example
Consider the 32-bit binary number 00000000001111111111000000000000
(hexadecimal 0x3FF000
).
_fbh_i32 and _fbh_u32 both return 11, which is the position, counted from the leftmost bit, of the 1, indicated by italic text. These two functions behave differently only when the highest bit, bit 31, is set in the input value. In such a case, _fbh_i32 returns the number of leading '1's and _fbh_u32 returns 0.
_fbl returns 13, which is the position, counted from the rightmost bit, of the 1, indicated by bold text.