different Rightmost Bit
// DDD:
function differentRightmostBit($n, $m) {
return call_user_func(function($n,$m){
$na = str_split(strrev(str_pad(decbin($n),32,'0',STR_PAD_LEFT)));
$ma = str_split(strrev(str_pad(decbin($m),32,'0',STR_PAD_LEFT)));
for($i = 0; $i <32; $i++){
if($na[$i] != $ma[$i]){
return pow(2,$i);
}
}
}, $n,$m); ;
}
function differentRightmostBit($n, $m) {
return pow(2, strspn(strrev(sprintf('%032b', $n)) ^ strrev(sprintf('%032b', $m)), "\0")) ;
}
function differentRightmostBit($n, $m) {
return (($n ^$m) &-($n ^$m));
}