set_bit in integer
DeaD_EyE Sep 21st, 2018 (edited) 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def set_bit(integer, bit_number, boolean):
- mask = 0x1 << bit_number
- return integer | mask if boolean else integer & ~mask
RAW Paste Data