Last active
March 7, 2019 00:55
-
-
Save yphastos/8517c385e31354d97ce388f8bdbb485a to your computer and use it in GitHub Desktop.
second Rightmost Zero Bit
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
int secondRightmostZeroBit(int n) { | |
return ~(n|(n+1)) & ((n|(n+1))+1) ; | |
} | |
int secondRightmostZeroBit(int n) { | |
return (~n) & ((n | ((~n) & (n+1))) +1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment