public function DecoderTest::generateLargeUint in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/vendor/maxmind-db/reader/tests/MaxMind/Db/Test/Reader/DecoderTest.php \MaxMind\Db\Test\Reader\DecoderTest::generateLargeUint()
2 calls to DecoderTest::generateLargeUint()
- DecoderTest::testUint128 in includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ Reader/ DecoderTest.php - DecoderTest::testUint64 in includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ Reader/ DecoderTest.php
File
- includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ Reader/ DecoderTest.php, line 242
Class
Namespace
MaxMind\Db\Test\ReaderCode
public function generateLargeUint($bits) {
$ctrlByte = $bits == 64 ? 0x2 : 0x3;
$uints = array(
0 => array(
0x0,
$ctrlByte,
),
500 => array(
0x2,
$ctrlByte,
0x1,
0xf4,
),
10872 => array(
0x2,
$ctrlByte,
0x2a,
0x78,
),
);
for ($power = 1; $power <= $bits / 8; $power++) {
$expected = bcsub(bcpow(2, 8 * $power), 1);
$input = array(
$power,
$ctrlByte,
);
for ($i = 2; $i < 2 + $power; $i++) {
$input[$i] = 0xff;
}
$uints[$expected] = $input;
}
return $uints;
}