Last active
March 7, 2019 00:55
-
-
Save yphastos/80ff195bf9d7eacab03d7111cbc801af 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
int differentRightmostBit(int n, int m) { | |
return (n^=m) & -n ; | |
} | |
int differentRightmostBit(int n, int m) { | |
return Integer.lowestOneBit(n^m) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment