Description:
1
bits (set bits) in an integer.Syntax:
int __builtin_popcount(unsigned int x);
Example:
#include <iostream>
int main() {
unsigned int x = 29; // Binary: 00011101
int count = __builtin_popcount(x);
std::cout << "Number of 1 bits in " << x << " is " << count << std::endl; // Output: 4
return 0;
}