yphastos
8/1/2017 - 3:36 PM

second Rightmost Zero Bit

second Rightmost Zero Bit

function secondRightmostZeroBit(n) {
  return ~(n |= -~n) & -~n;
}

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