Then we remove all but the top bit by xor ' ing ▁ the ▁ ▁ string ▁ of ▁ 1' s with that string of 1 ' s ▁ shifted ▁ one ▁ to ▁ ▁ the ▁ left , ▁ and ▁ we ▁ end ▁ up ▁ with ▁ just ▁ the ▁ one ▁ top ▁ bit ▁ ▁ followed ▁ by ▁ 0' s .
return x ^ ( x >> 1 ) ; }