From 2e377db5d5d6a197379941bc59b1b18996ea64c9 Mon Sep 17 00:00:00 2001 From: Elvin Date: Mon, 6 Jan 2020 14:38:52 +0800 Subject: [PATCH] Update vm.go fixbug: get wrong result when execute opcodes.F64ConvertSI32 & opcodes.F64ConvertUI32 --- exec/vm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec/vm.go b/exec/vm.go index 2b52392..eb66a05 100644 --- a/exec/vm.go +++ b/exec/vm.go @@ -1461,12 +1461,12 @@ func (vm *VirtualMachine) Execute() { case opcodes.F64ConvertSI32: v := int32(frame.Regs[int(LE.Uint32(frame.Code[frame.IP:frame.IP+4]))]) frame.IP += 4 - frame.Regs[valueID] = int64(int32(math.Float64bits(float64(v)))) + frame.Regs[valueID] = int64(math.Float64bits(float64(v))) case opcodes.F64ConvertUI32: v := uint32(frame.Regs[int(LE.Uint32(frame.Code[frame.IP:frame.IP+4]))]) frame.IP += 4 - frame.Regs[valueID] = int64(int32(math.Float64bits(float64(v)))) + frame.Regs[valueID] = int64(math.Float64bits(float64(v))) case opcodes.F64ConvertSI64: v := int64(frame.Regs[int(LE.Uint32(frame.Code[frame.IP:frame.IP+4]))])