Saved from https://leetcode-cn.com/problems/number-of-1-bits/submissions/
func hammingWeight(num uint32) int { s := 0 for num != 0 { s++ num &= num - 1 } return s }