Esempio n. 1
0
 static function UnPackJsonNumber($bytearray, &$seek, $tagfirst)
 {
     $isFloat = ($tagfirst & 32) > 0;
     $isBool = ($tagfirst & 16) > 0;
     $isNull = ($tagfirst & 8) > 0;
     $isNeg = ($tagfirst & 4) > 0;
     $blen = $tagfirst % 4 + 1;
     if ($isBool) {
         return $isNull;
     } else {
         if ($isNull) {
             return null;
         } else {
             if ($isFloat) {
                 return JsonPack::ReadFloatPiece($bytearray, $seek, $blen);
             } else {
                 $v = JsonPack::ReadIntPiece($bytearray, $seek, $blen);
                 return $isNeg ? -$v : $v;
             }
         }
     }
     return number;
 }