[sync] a little speedup for the MBUInt32toInt

Anton Hummel anton.hummel at bigwasp.net
Wed Dec 17 13:46:35 PST 2003


Hi

I have made a little change to MBUInt32toInt function
what´s your opinion about this

function MBUInt32ToInt($in)
    {
        $val = 0;  // return value
        $j   = 0;  // for errorhandling
        $b   = 0;  // byte from file

        do {
            $j++
            // if !($j < 6) then error(" not a valid multibyte int32")
            $b = ord(fread($in, 1));
            $val <<= 7;  // bitshift left 7 bits
            $val += ($b & 127);

        } while (($b & 128) != 0);

        return $value;
    }


bye Anton


More information about the sync mailing list