private function Decoder::sizeFromCtrlByte in Smart IP 6.2
Same name and namespace in other branches
- 7.2 includes/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php \MaxMind\Db\Reader\Decoder::sizeFromCtrlByte()
1 call to Decoder::sizeFromCtrlByte()
- Decoder::decode in includes/
vendor/ maxmind-db/ reader/ src/ MaxMind/ Db/ Reader/ Decoder.php
File
- includes/
vendor/ maxmind-db/ reader/ src/ MaxMind/ Db/ Reader/ Decoder.php, line 274
Class
Namespace
MaxMind\Db\ReaderCode
private function sizeFromCtrlByte($ctrlByte, $offset) {
$size = $ctrlByte & 0x1f;
$bytesToRead = $size < 29 ? 0 : $size - 28;
$bytes = Util::read($this->fileStream, $offset, $bytesToRead);
$decoded = $this
->decodeUint($bytes);
if ($size == 29) {
$size = 29 + $decoded;
}
elseif ($size == 30) {
$size = 285 + $decoded;
}
elseif ($size > 30) {
$size = ($decoded & 0xfffffff >> 32 - 8 * $bytesToRead) + 65821;
}
return array(
$size,
$offset + $bytesToRead,
);
}