yphastos
8/1/2017 - 3:37 PM

second Rightmost Zero Bit

second Rightmost Zero Bit

int secondRightmostZeroBit(int n) {
  return ~(n|(n+1)) & ((n|(n+1))+1) ;
}

int secondRightmostZeroBit(int n) {
  return (~n) & ((n | ((~n) & (n+1))) +1);
}