diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-03 21:01:46 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-04 07:23:59 +0900 |
| commit | 8b689c5ff077252a68c88bc7d70990405fc8dd5a (patch) | |
| tree | 216bef1b2bd71892086a2961617bcdb7d22ea2b1 /src/BinaryFormat/Decoder.php | |
| parent | 996259e6a1a04f91179d2b83cc19e3fbb371cd33 (diff) | |
| download | php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.tar.gz php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.tar.zst php-waddiwasi-8b689c5ff077252a68c88bc7d70990405fc8dd5a.zip | |
feat: implement more instructions
Diffstat (limited to 'src/BinaryFormat/Decoder.php')
| -rw-r--r-- | src/BinaryFormat/Decoder.php | 4 |
1 files changed, 2 insertions, 2 deletions
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"); } |
