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