1 int count_one(unsigned num){ 2 int count=0; 3 while(num){ 4 count++; 5 num=num&(num-1); 6 } 7 return count; 8 }