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