Last active
March 7, 2019 00:53
-
-
Save yphastos/34e0b3cc4da1a0d48ea5d87ed115f44a to your computer and use it in GitHub Desktop.
different Rightmost Bit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function differentRightmostBit(n, m) { | |
return (n^m) & -(n^m); | |
} | |
function differentRightmostBit(n, m) { | |
return (n ^= m) & -n; | |
} | |
function differentRightmostBit(n, m) { | |
return (n ^ m) & (~(n ^ m) + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment