| @@ 410-422 (lines=13) @@ | ||
| 407 | * |
|
| 408 | * @return int |
|
| 409 | */ |
|
| 410 | public function readInt16() |
|
| 411 | { |
|
| 412 | $data = $this->read(2); |
|
| 413 | ||
| 414 | if ($this->getByteOrder() !== ByteOrder::MACHINE_ENDIAN |
|
| 415 | && $this->getByteOrder() !== $this->getMachineByteOrder() |
|
| 416 | ) { |
|
| 417 | $data = strrev($data); |
|
| 418 | } |
|
| 419 | ||
| 420 | list(, $value) = unpack('s', $data); |
|
| 421 | return $value; |
|
| 422 | } |
|
| 423 | ||
| 424 | /** |
|
| 425 | * Read unsigned 16-bit integer (short) data from the stream. |
|
| @@ 505-517 (lines=13) @@ | ||
| 502 | * |
|
| 503 | * @return int |
|
| 504 | */ |
|
| 505 | public function readInt32() |
|
| 506 | { |
|
| 507 | $data = $this->read(4); |
|
| 508 | ||
| 509 | if ($this->getByteOrder() !== ByteOrder::MACHINE_ENDIAN |
|
| 510 | && $this->getByteOrder() !== $this->getMachineByteOrder() |
|
| 511 | ) { |
|
| 512 | $data = strrev($data); |
|
| 513 | } |
|
| 514 | ||
| 515 | list(, $value) = unpack('l', $data); |
|
| 516 | return $value; |
|
| 517 | } |
|
| 518 | ||
| 519 | /** |
|
| 520 | * Read unsigned 32-bit integer (long) data from the stream. |
|
| @@ 554-566 (lines=13) @@ | ||
| 551 | * |
|
| 552 | * @return int |
|
| 553 | */ |
|
| 554 | public function readInt64() |
|
| 555 | { |
|
| 556 | $data = $this->read(8); |
|
| 557 | ||
| 558 | if ($this->getByteOrder() !== ByteOrder::MACHINE_ENDIAN |
|
| 559 | && $this->getByteOrder() !== $this->getMachineByteOrder() |
|
| 560 | ) { |
|
| 561 | $data = strrev($data); |
|
| 562 | } |
|
| 563 | ||
| 564 | list(, $value) = unpack('q', $data); |
|
| 565 | return $value; |
|
| 566 | } |
|
| 567 | ||
| 568 | /** |
|
| 569 | * Read unsigned 64-bit integer (long long) data from the stream. |
|