helper/lookup_table_generator.c
static int hamming_weight_32bit(uint32_t val) {
    val -= ((val >> 1) & 0x55555555);
    val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
    val = (val + (val >> 4)) & 0x0f0f0f0f;
    val = (val * 0x01010101) >> 24;
    return val;
}
/**
 * Hamming weight algorithm using 12 arithmetic operations.
 * 32bit version of the algorithm.
 **/
Hamming weight algorithm using 12 arithmetic operations.
32bit version of the algorithm.
Hamming weight algorithm using 12 arithmetic operations . 32bit version of the algorithm .
static int hamming_weight_32bit(uint32_t val) {
    val -= ((val >> 1) & 0x55555555);
    val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
    val = (val + (val >> 4)) & 0x0f0f0f0f;
    val = (val * 0x01010101) >> 24;
    return val;
}
static int hamming_weight_32bit ( uint32_t val ) { val -= ( ( val >> 1 ) & 0x55555555 ) ; val = ( val & 0x33333333 ) + ( ( val >> 2 ) & 0x33333333 ) ; val = ( val + ( val >> 4 ) ) & 0x0f0f0f0f ; val = ( val * 0x01010101 ) >> 24 ; return val ; }
Hamming weight algorithm using 12 arithmetic operations.
Hamming weight algorithm using 12 arithmetic operations .