@@ 74-86 (lines=13) @@ | ||
71 | * |
|
72 | * @return int |
|
73 | */ |
|
74 | public function readSignedInteger16() |
|
75 | { |
|
76 | $data = $this->read(2); |
|
77 | ||
78 | if ($this->getByteOrder() !== ByteOrder::MACHINE_ENDIAN |
|
79 | && $this->getByteOrder() !== $this->getMachineByteOrder() |
|
80 | ) { |
|
81 | $data = strrev($data); |
|
82 | } |
|
83 | ||
84 | list(, $value) = unpack('s', $data); |
|
85 | return $value; |
|
86 | } |
|
87 | ||
88 | /** |
|
89 | * Read unsigned 24-bit integer (short) data from the stream |
|
@@ 176-188 (lines=13) @@ | ||
173 | * |
|
174 | * @return int |
|
175 | */ |
|
176 | public function readSignedInteger32() |
|
177 | { |
|
178 | $data = $this->read(4); |
|
179 | ||
180 | if ($this->getByteOrder() !== ByteOrder::MACHINE_ENDIAN |
|
181 | && $this->getByteOrder() !== $this->getMachineByteOrder() |
|
182 | ) { |
|
183 | $data = strrev($data); |
|
184 | } |
|
185 | ||
186 | list(, $value) = unpack('l', $data); |
|
187 | return $value; |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * Read unsigned 64-bit integer (long long) data from the stream |
|
@@ 217-229 (lines=13) @@ | ||
214 | * |
|
215 | * @return int |
|
216 | */ |
|
217 | public function readSignedInteger64() |
|
218 | { |
|
219 | $data = $this->read(8); |
|
220 | ||
221 | if ($this->getByteOrder() !== ByteOrder::MACHINE_ENDIAN |
|
222 | && $this->getByteOrder() !== $this->getMachineByteOrder() |
|
223 | ) { |
|
224 | $data = strrev($data); |
|
225 | } |
|
226 | ||
227 | list(, $value) = unpack('q', $data); |
|
228 | return $value; |
|
229 | } |
|
230 | } |
|
231 |