| @@ 162-172 (lines=11) @@ | ||
| 159 | * @return int |
|
| 160 | * @throws \MySQLReplication\BinaryDataReader\BinaryDataReaderException |
|
| 161 | */ |
|
| 162 | public function readInt24() |
|
| 163 | { |
|
| 164 | $data = unpack('C3', $this->read(self::UNSIGNED_INT24_LENGTH)); |
|
| 165 | ||
| 166 | $res = $data[1] | ($data[2] << 8) | ($data[3] << 16); |
|
| 167 | if ($res >= 0x800000) { |
|
| 168 | $res -= 0x1000000; |
|
| 169 | } |
|
| 170 | ||
| 171 | return $res; |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|
| 175 | * @return string |
|
| @@ 325-335 (lines=11) @@ | ||
| 322 | * @return int |
|
| 323 | * @throws \MySQLReplication\BinaryDataReader\BinaryDataReaderException |
|
| 324 | */ |
|
| 325 | public function readInt24Be() |
|
| 326 | { |
|
| 327 | $data = unpack('C3', $this->read(self::UNSIGNED_INT24_LENGTH)); |
|
| 328 | $res = ($data[1] << 16) | ($data[2] << 8) | $data[3]; |
|
| 329 | if ($res >= 0x800000) { |
|
| 330 | $res -= 0x1000000; |
|
| 331 | } |
|
| 332 | ||
| 333 | return $res; |
|
| 334 | } |
|
| 335 | ||
| 336 | /** |
|
| 337 | * @return int |
|
| 338 | * @throws \MySQLReplication\BinaryDataReader\BinaryDataReaderException |
|