__builtin_popcountll
, __builtin_clzll
, __builtin_ctzll
, __builtin_parityll
Description:
long long
(64-bit) integers.Example:
#include <iostream>
int main() {
unsigned long long x = 123456789101112; // Example 64-bit number
int count = __builtin_popcountll(x);
int leading_zeros = __builtin_clzll(x);
int trailing_zeros = __builtin_ctzll(x);
int parity = __builtin_parityll(x);
std::cout << "Number of 1 bits: " << count << std::endl;
std::cout << "Number of leading zeros: " << leading_zeros << std::endl;
std::cout << "Number of trailing zeros: " << trailing_zeros << std::endl;
std::cout << "Parity: " << parity << std::endl;
return 0;
}