Format
#include <builtin.h>unsigned int __cntlz8(unsigned long long num)
Language Level: None
__cntlz8 calculates the number of leading (ie. most significant)
zero bits in the 8 byte unsigned value num.
Return Value
Returns the number of leading zero bits. If num
is zero, then 64 is returned.
Example
This example calculates the number of leading zero bits
in the 8 byte value 0x0000000000002000.
#include <stdio.h> #include <builtin.h>
unsigned long long input = 0x0000000000002000ULL;
int main(void)
{
printf("The number of leading zero bits in %.16llx is %u.\n",
input, __cntlz8(input));
/************************************************************
The output should be:
The number of leading zero bits in 0000000000002000 is 50. ************************************************************/
return 0; }
![]()
__cntlz4 -- Count Leading Zero Bits in 4
Byte Value
__cnttz4 -- Count Trailing Zero Bits in 4
Byte Value
__cnttz8 -- Count Trailing Zero Bits in 8
Byte Value