Skip to content

Commit

Permalink
fixed Unpacker -TINY_INT in proper way
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanak-michal committed Oct 25, 2020
1 parent 397d6a3 commit d5f1744
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
.vscode/
phpunit*.phar
/index.php
2 changes: 1 addition & 1 deletion src/PackStream/v1/Unpacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private function unpackInteger(int $marker, bool &$result = false): int
if ($marker >> 7 == 0b0) { //+TINY_INT
$output = $marker;
} elseif ($marker >> 4 == 0b1111) { //-TINY_INT
$output = -16 + (0b11110000 ^ $marker);
$output = unpack('c', strrev(chr($marker)))[1] ?? 0;
} elseif ($marker == 0xC8) { //INT_8
$output = unpack('c', $this->next(1))[1] ?? 0;
} elseif ($marker == 0xC9) { //INT_16
Expand Down

0 comments on commit d5f1744

Please sign in to comment.