[sync] a little speedup for the MBUInt32toInt

Anthony Mills amills at gascard.net
Wed Dec 17 14:09:56 PST 2003


Does it work?  Looks much nicer than what I did.

Anthony

Anton Hummel wrote:
> 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