/* counts the number of 1 bits in a its integer argument */ int bitcount(int n) { int val; for (val = 0; n != 0; n &= (n-1), val++); return val; }