This is a loop with 32 iterations, each includes one bit shifting and one bit-wise and. I think the complexity is O(1). Correct me please if I made any mistake.

```
class Solution {
public:
int hammingWeight(uint32_t n) {
int i = 0, sum = 0;
uint32_t one = 1;
for(i = 0; i < 32; i++){
sum += ((n>>i) & one);
}
return sum;
}
};
```