Check out example codes for "setbits". It will help you in understanding the concepts better.

Code Example 1

// C++ program to demonstrate __builtin_popcount() 
#include <iostream> 
using namespace std; 
  
int main() 
{ 
    cout << __builtin_popcount(4) << endl; 
    cout << __builtin_popcount(15); 
  
    return 0; 
}

Learn ReactJs, React Native from akashmittal.com