链接:https://leetcode-cn.com/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/submissions/
class Solution { public: int hammingWeight(uint32_t n) { int s = 0; while (n) s += n & 1, n >>= 1; return s; } };
原文:https://www.cnblogs.com/clown9804/p/12337391.html