| @@ 226-238 (lines=13) @@ | ||
| 223 | return $hi << 8 | $lo; |
|
| 224 | } |
|
| 225 | ||
| 226 | private function unpackUint32() |
|
| 227 | { |
|
| 228 | if (!isset($this->buffer[$this->offset + 3])) { |
|
| 229 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4); |
|
| 230 | } |
|
| 231 | ||
| 232 | $num = \substr($this->buffer, $this->offset, 4); |
|
| 233 | $this->offset += 4; |
|
| 234 | ||
| 235 | $num = \unpack('N', $num); |
|
| 236 | ||
| 237 | return $num[1]; |
|
| 238 | } |
|
| 239 | ||
| 240 | private function unpackUint64() |
|
| 241 | { |
|
| @@ 294-306 (lines=13) @@ | ||
| 291 | return $hi << 8 | $lo; |
|
| 292 | } |
|
| 293 | ||
| 294 | private function unpackInt32() |
|
| 295 | { |
|
| 296 | if (!isset($this->buffer[$this->offset + 3])) { |
|
| 297 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4); |
|
| 298 | } |
|
| 299 | ||
| 300 | $num = \substr($this->buffer, $this->offset, 4); |
|
| 301 | $this->offset += 4; |
|
| 302 | ||
| 303 | $num = \unpack('i', \strrev($num)); |
|
| 304 | ||
| 305 | return $num[1]; |
|
| 306 | } |
|
| 307 | ||
| 308 | private function unpackInt64() |
|
| 309 | { |
|
| @@ 308-320 (lines=13) @@ | ||
| 305 | return $num[1]; |
|
| 306 | } |
|
| 307 | ||
| 308 | private function unpackInt64() |
|
| 309 | { |
|
| 310 | if (!isset($this->buffer[$this->offset + 7])) { |
|
| 311 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 8); |
|
| 312 | } |
|
| 313 | ||
| 314 | $num = \substr($this->buffer, $this->offset, 8); |
|
| 315 | $this->offset += 8; |
|
| 316 | ||
| 317 | $set = \unpack('N2', $num); |
|
| 318 | ||
| 319 | return $set[1] << 32 | $set[2]; |
|
| 320 | } |
|
| 321 | ||
| 322 | private function unpackFloat32() |
|
| 323 | { |
|
| @@ 322-334 (lines=13) @@ | ||
| 319 | return $set[1] << 32 | $set[2]; |
|
| 320 | } |
|
| 321 | ||
| 322 | private function unpackFloat32() |
|
| 323 | { |
|
| 324 | if (!isset($this->buffer[$this->offset + 3])) { |
|
| 325 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4); |
|
| 326 | } |
|
| 327 | ||
| 328 | $num = \substr($this->buffer, $this->offset, 4); |
|
| 329 | $this->offset += 4; |
|
| 330 | ||
| 331 | $num = \unpack('f', \strrev($num)); |
|
| 332 | ||
| 333 | return $num[1]; |
|
| 334 | } |
|
| 335 | ||
| 336 | private function unpackFloat64() |
|
| 337 | { |
|
| @@ 336-348 (lines=13) @@ | ||
| 333 | return $num[1]; |
|
| 334 | } |
|
| 335 | ||
| 336 | private function unpackFloat64() |
|
| 337 | { |
|
| 338 | if (!isset($this->buffer[$this->offset + 7])) { |
|
| 339 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 8); |
|
| 340 | } |
|
| 341 | ||
| 342 | $num = \substr($this->buffer, $this->offset, 8); |
|
| 343 | $this->offset += 8; |
|
| 344 | ||
| 345 | $num = \unpack('d', \strrev($num)); |
|
| 346 | ||
| 347 | return $num[1]; |
|
| 348 | } |
|
| 349 | ||
| 350 | private function unpackStr($length) |
|
| 351 | { |
|