Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 170 Bytes

Bit-Manipulation.md

File metadata and controls

20 lines (13 loc) · 170 Bytes

Bit Manipulation

Check if a number is power of two

x & (x-1) == 0

Left shift

(a << k) => a*2^k

Right shift

(a >> k) => a/2^k