Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Preparation2.0' into Preparation2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Oct 21, 2021
2 parents e458dc5 + dfce237 commit 2bacf90
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/LengthCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ public static function getLengthOfArray(array $data): array
private static function computeLength(int $length): array
{
switch (true) {
case $length < 24:
case $length <= 23:
return [$length, null];
case $length < 0xFF:
case $length <= 0xFF:
return [24, chr($length)];
case $length < 0xFFFF:
return [25, self::hex2bin(dechex($length))];
case $length < 0xFFFFFFFF:
return [26, self::hex2bin(dechex($length))];
case BigInteger::of($length)->isLessThan(BigInteger::fromBase('FFFFFFFFFFFFFFFF', 16)):
return [27, self::hex2bin(dechex($length))];
case $length <= 0xFFFF:
return [25, self::hex2bin(static::fixHexLength(Utils::intToHex($length)))];
case $length <= 0xFFFFFFFF:
return [26, self::hex2bin(static::fixHexLength(Utils::intToHex($length)))];
case BigInteger::of($length)->isLessThanOrEqualTo(BigInteger::fromBase('FFFFFFFFFFFFFFFF', 16)):
return [27, self::hex2bin(static::fixHexLength(Utils::intToHex($length)))];
default:
return [31, null];
}
Expand Down

0 comments on commit 2bacf90

Please sign in to comment.