| @@ 432-444 (lines=13) @@ | ||
| 429 | return $hi << 8 | $lo; |
|
| 430 | } |
|
| 431 | ||
| 432 | private function unpackUint32() |
|
| 433 | { |
|
| 434 | if (!isset($this->buffer[$this->offset + 3])) { |
|
| 435 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4); |
|
| 436 | } |
|
| 437 | ||
| 438 | $num = \substr($this->buffer, $this->offset, 4); |
|
| 439 | $this->offset += 4; |
|
| 440 | ||
| 441 | $num = \unpack('N', $num); |
|
| 442 | ||
| 443 | return $num[1]; |
|
| 444 | } |
|
| 445 | ||
| 446 | private function unpackUint64() |
|
| 447 | { |
|
| @@ 496-508 (lines=13) @@ | ||
| 493 | return $hi << 8 | $lo; |
|
| 494 | } |
|
| 495 | ||
| 496 | private function unpackInt32() |
|
| 497 | { |
|
| 498 | if (!isset($this->buffer[$this->offset + 3])) { |
|
| 499 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4); |
|
| 500 | } |
|
| 501 | ||
| 502 | $num = \substr($this->buffer, $this->offset, 4); |
|
| 503 | $this->offset += 4; |
|
| 504 | ||
| 505 | $num = \unpack('i', \strrev($num)); |
|
| 506 | ||
| 507 | return $num[1]; |
|
| 508 | } |
|
| 509 | ||
| 510 | private function unpackInt64() |
|
| 511 | { |
|
| @@ 510-522 (lines=13) @@ | ||
| 507 | return $num[1]; |
|
| 508 | } |
|
| 509 | ||
| 510 | private function unpackInt64() |
|
| 511 | { |
|
| 512 | if (!isset($this->buffer[$this->offset + 7])) { |
|
| 513 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 8); |
|
| 514 | } |
|
| 515 | ||
| 516 | $num = \substr($this->buffer, $this->offset, 8); |
|
| 517 | $this->offset += 8; |
|
| 518 | ||
| 519 | $set = \unpack('N2', $num); |
|
| 520 | ||
| 521 | return $set[1] << 32 | $set[2]; |
|
| 522 | } |
|
| 523 | ||
| 524 | private function unpackFloat32() |
|
| 525 | { |
|
| @@ 524-536 (lines=13) @@ | ||
| 521 | return $set[1] << 32 | $set[2]; |
|
| 522 | } |
|
| 523 | ||
| 524 | private function unpackFloat32() |
|
| 525 | { |
|
| 526 | if (!isset($this->buffer[$this->offset + 3])) { |
|
| 527 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4); |
|
| 528 | } |
|
| 529 | ||
| 530 | $num = \substr($this->buffer, $this->offset, 4); |
|
| 531 | $this->offset += 4; |
|
| 532 | ||
| 533 | $num = \unpack('f', \strrev($num)); |
|
| 534 | ||
| 535 | return $num[1]; |
|
| 536 | } |
|
| 537 | ||
| 538 | private function unpackFloat64() |
|
| 539 | { |
|
| @@ 538-550 (lines=13) @@ | ||
| 535 | return $num[1]; |
|
| 536 | } |
|
| 537 | ||
| 538 | private function unpackFloat64() |
|
| 539 | { |
|
| 540 | if (!isset($this->buffer[$this->offset + 7])) { |
|
| 541 | throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 8); |
|
| 542 | } |
|
| 543 | ||
| 544 | $num = \substr($this->buffer, $this->offset, 8); |
|
| 545 | $this->offset += 8; |
|
| 546 | ||
| 547 | $num = \unpack('d', \strrev($num)); |
|
| 548 | ||
| 549 | return $num[1]; |
|
| 550 | } |
|
| 551 | ||
| 552 | private function unpackStrData($length) |
|
| 553 | { |
|