[Solved] Cannot understand some c++


This: >>= is the shift right assignment operator which performs the shift right operation on b and reassigns it to b. >>= 1 basically divides b by 2.

It shifts all the bits 1 to the right.

eg if b in binary is 00000010 (2 in decimal), b >>= 1 would make b = 00000001 (1 in decimal). another eg2: 00001110 (14) would be become 00000111 (7) etc Do that again though and you lose precision: 00000111 (7) becomes 00000011 (3).

solved Cannot understand some c++