Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

flip specific bit python

# To flip the kth bit of x, XOR it with 1 leftshifted k times 
x = x ^ (1 << k)
 
PREVIOUS NEXT
Tagged: #flip #specific #bit #python
ADD COMMENT
Topic
Name
4+5 =