Skip to content

Instantly share code, notes, and snippets.

@yphastos
Last active March 7, 2019 00:55
Show Gist options
  • Save yphastos/80ff195bf9d7eacab03d7111cbc801af to your computer and use it in GitHub Desktop.
Save yphastos/80ff195bf9d7eacab03d7111cbc801af to your computer and use it in GitHub Desktop.
different Rightmost Bit
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