master-algorithms-py/bit_manipulation
2023-07-16 17:35:14 -07:00
..
playing_with_bits.py Add some cool queue, stacks, strings, math, bit manipulation examples (#35) 2023-07-16 17:35:14 -07:00
README.md Add some cool queue, stacks, strings, math, bit manipulation examples (#35) 2023-07-16 17:35:14 -07:00

bit manipulation


playing_with_bits.py


> python3 playing_with_bits.py

Integer number: 144
Binary number: 10010000

Update bit: 0b10010100
Set bit: 0b10010100
Clear bit: 0b10000000

I: 144, I2: 90
B: 10010000, B2: 01011010
Count bits swapped: 4

Swap bit in place: (90, 144)