Skip to content

Commit

Permalink
Add shortcut readBool for reading uint as bool
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Aug 2, 2021
1 parent 2703773 commit 0d1a085
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/VarInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public static function readUint(string $hex, int $offset = 0): array {
return [0, 0];
}

public static function readBool(string $hex, int $offset = 0): array {
[$flag, $next_offset] = static::readUint($hex, $offset);
return [!!$flag, $next_offset];
}

public static function packUint(int $value): string {
$h = '';
$i = 0;
Expand Down

0 comments on commit 0d1a085

Please sign in to comment.