diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-05-19 14:08:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-05-19 14:08:38 +0900 |
| commit | 74451aa848d88d1175e52f5c4dd7234cb84fa7f8 (patch) | |
| tree | 3f2f104b647bb699950f19c6308b29e48fe6be1d /src | |
| parent | 7cec89f22a9a09916f1b9c98fc117ec4a1ea7793 (diff) | |
| download | php-waddiwasi-74451aa848d88d1175e52f5c4dd7234cb84fa7f8.tar.gz php-waddiwasi-74451aa848d88d1175e52f5c4dd7234cb84fa7f8.tar.zst php-waddiwasi-74451aa848d88d1175e52f5c4dd7234cb84fa7f8.zip | |
fix: fNN.reinterpret_iMM
Diffstat (limited to 'src')
| -rw-r--r-- | src/Execution/Runtime.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 8944ff1..ae76b06 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -695,13 +695,19 @@ final class Runtime private function execInstrNumericF32ReinterpretI32(Instrs\Numeric\F32ReinterpretI32 $instr): void { $v = $this->stack->popInt(); - $this->stack->pushValue($v); + $result = unpack('f', pack('l', $v)); + assert($result !== false); + $vAsF32 = $result[1]; + $this->stack->pushValue($vAsF32); } private function execInstrNumericF32ReinterpretI64(Instrs\Numeric\F32ReinterpretI64 $instr): void { $v = $this->stack->popInt(); - $this->stack->pushValue($v); + $result = unpack('f', pack('q', $v)); + assert($result !== false); + $vAsF32 = $result[1]; + $this->stack->pushValue($vAsF32); } private function execInstrNumericF32Sqrt(Instrs\Numeric\F32Sqrt $instr): void @@ -875,13 +881,19 @@ final class Runtime private function execInstrNumericF64ReinterpretI32(Instrs\Numeric\F64ReinterpretI32 $instr): void { $v = $this->stack->popInt(); - $this->stack->pushValue($v); + $result = unpack('d', pack('l', $v)); + assert($result !== false); + $vAsF64 = $result[1]; + $this->stack->pushValue($vAsF64); } private function execInstrNumericF64ReinterpretI64(Instrs\Numeric\F64ReinterpretI64 $instr): void { $v = $this->stack->popInt(); - $this->stack->pushValue($v); + $result = unpack('d', pack('q', $v)); + assert($result !== false); + $vAsF64 = $result[1]; + $this->stack->pushValue($vAsF64); } private function execInstrNumericF64Sqrt(Instrs\Numeric\F64Sqrt $instr): void |
