# LeetCode191 Number of 1 Bits

## 描述

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).

## 思路

n = (n & (0x55555555)) + ((n >> 1) & (0x55555555));

(n >> 1) & 0x55555555就可以提取$n$奇数位上的1：

(n >> 2) & 0x33333333 （注意，现在要右移两位）就等于：