diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-05-18 14:27:02 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-05-18 14:27:44 +0900 |
| commit | b5455751929d7f9a3581e27eb0adcf7ef9d01a0c (patch) | |
| tree | f49ea4b7f2adcaac974df66f09e5191404570a6e /src | |
| parent | 7d60e82bfb076f4e5549c0552298002a931960ff (diff) | |
| download | php-waddiwasi-b5455751929d7f9a3581e27eb0adcf7ef9d01a0c.tar.gz php-waddiwasi-b5455751929d7f9a3581e27eb0adcf7ef9d01a0c.tar.zst php-waddiwasi-b5455751929d7f9a3581e27eb0adcf7ef9d01a0c.zip | |
fix: i64.shr_u
Diffstat (limited to 'src')
| -rw-r--r-- | src/Execution/Runtime.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index d15e098..90d05e6 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -1570,8 +1570,13 @@ final class Runtime { $c2 = $this->stack->popInt(); $k = $c2 % 64; + if ($k === 0) { + return; + } + // Perform shr_u based on string manipulation because PHP does not + // support shr_u operation. $c1 = $this->stack->popInt(); - $this->stack->pushValue($c1 >> $k); + $this->stack->pushValue(bindec(substr(decbin($c1), 0, -$k))); } private function execInstrNumericI64Sub(Instrs\Numeric\I64Sub $instr): void |
