LibWasm: Fix some floating-point conversion issues

NaN bit patterns are now (hopefully) preserved. `static_cast` does not
preserve the bit pattern of a given NaN, so ideally we'd use some other
sort of cast and avoid `static_cast` altogether, but that's a large
change for this commit. For now, this fixes the issues found in spec
tests.
This commit is contained in:
Diego
2024-07-03 18:33:55 -07:00
committed by Ali Mohammad Pur
parent 6493acf2f4
commit c882498d44
2 changed files with 5 additions and 5 deletions

View File

@@ -519,10 +519,10 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
configuration.stack().push(Value(ValueType { ValueType::I64 }, instruction.arguments().get<i64>()));
return;
case Instructions::f32_const.value():
configuration.stack().push(Value(ValueType { ValueType::F32 }, static_cast<double>(instruction.arguments().get<float>())));
configuration.stack().push(Value(Value::AnyValueType(instruction.arguments().get<float>())));
return;
case Instructions::f64_const.value():
configuration.stack().push(Value(ValueType { ValueType::F64 }, instruction.arguments().get<double>()));
configuration.stack().push(Value(Value::AnyValueType(instruction.arguments().get<double>())));
return;
case Instructions::block.value(): {
size_t arity = 0;