I just showed him that it can be solved without operations between bits.
Does this make it seem less "odd"?
void setup() {
Serial.begin(115200);
uint16_t num = 0b0110100011100101; // number to test
int cnt = 0; // 1's counter
while (num > 0) {
cnt += num & 1;
num >>= 1;
}
Serial.println(cnt);
}
void loop() {
}
Regards