yphastos
8/1/2017 - 3:34 PM

get second rightmost 0 bit as int

get second rightmost 0 bit as int

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