Exemple #1
0
 function bin_sub_carry($bin, $pos)
 {
     $str = $bin;
     if (substr($str, $pos, 1) != "") {
         if (substr($str, $pos, 1) == "0") {
             $str = substr_replace($str, "1", $pos, 1);
             $str = Netblock::bin_sub_carry($str, $pos - 1);
         } else {
             if (substr($str, $pos, 1) == "1") {
                 $str = substr_replace($str, "0", $pos, 1);
             }
         }
     } else {
         $is_negative = true;
     }
     return $str;
 }