Last active
March 7, 2019 00:55
-
-
Save yphastos/ee9c12a0be19b4f542973470b174695e to your computer and use it in GitHub Desktop.
get second rightmost 0 bit as int
This file contains 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 secondRightmostZeroBit($n) { | |
return ~($n | ($n+1)) & (($n | ($n+1))+1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment