Skip to content

Commit

Permalink
Fix bit flip
Browse files Browse the repository at this point in the history
s ^= ~(1 << k) would toggle all the bits except for the kth.
  • Loading branch information
Triang3l authored Mar 12, 2017
1 parent 74b9995 commit 335c333
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ or equal to those of the children and the lowest key is in the root node
* Test kth bit: `s & (1 << k)`
* Set kth bit: `s |= (1 << k)`
* Turn off kth bit: `s &= ~(1 << k)`
* Toggle kth bit: `s ^= ~(1 << k)`
* Toggle kth bit: `s ^= (1 << k)`
* Multiple by 2<sup>n</sup>: `s << n`
* Divide by 2<sup>n</sup>: `s >> n`
* Intersection: `s & t`
Expand Down

0 comments on commit 335c333

Please sign in to comment.