From 8b689c5ff077252a68c88bc7d70990405fc8dd5a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 3 Mar 2024 21:01:46 +0900 Subject: feat: implement more instructions --- src/BinaryFormat/Decoder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/BinaryFormat/Decoder.php') diff --git a/src/BinaryFormat/Decoder.php b/src/BinaryFormat/Decoder.php index 4922482..639e128 100644 --- a/src/BinaryFormat/Decoder.php +++ b/src/BinaryFormat/Decoder.php @@ -931,7 +931,7 @@ final class Decoder { $align = $this->decodeU32(); $offset = $this->decodeU32(); - return [$align, $offset]; + return [$offset, $align]; } private function decodeBlockType(): BlockType @@ -1049,6 +1049,7 @@ final class Decoder while (true) { $b = $this->decodeByte(); $result |= ($b & 0b01111111) << $shiftBits; + $shiftBits += 7; if ($b < 0b10000000) { if (($b & 0b01000000) !== 0) { if ($shiftBits < $bits - 1) { @@ -1059,7 +1060,6 @@ final class Decoder } return $result; } - $shiftBits += 7; if ($bits <= $shiftBits) { throw new InvalidBinaryFormatException("signed leb128"); } -- cgit v1.2.3-70-g09d2