• Description:

    • This function counts the number of leading zeros in the binary representation of an integer.
  • Syntax:

    int __builtin_clz(unsigned int x);
    
    
  • Example:

    #include <iostream>
    
    int main() {
        unsigned int x = 16; // Binary: 00000000000000000000000000010000
        int leading_zeros = __builtin_clz(x);
        std::cout << "Number of leading zeros in " << x << " is " << leading_zeros << std::endl; // Output: 27
    
        return 0;
    }