1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibWasm: Ensure that value signs are preserved when casting

Also makes normal arithmetic operations more spec-compliant by actually
ignoring overflow on them.
This commit is contained in:
Ali Mohammad Pur 2021-06-01 23:13:27 +04:30 committed by Ali Mohammad Pur
parent 02b3238c41
commit b15a5d6ada
2 changed files with 9 additions and 9 deletions

View file

@ -173,10 +173,10 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
auto value = vm.argument(index++).to_double(global_object);
switch (param.kind()) {
case Wasm::ValueType::Kind::I32:
arguments.append(Wasm::Value(static_cast<i32>(value)));
arguments.append(Wasm::Value(param, static_cast<u64>(value)));
break;
case Wasm::ValueType::Kind::I64:
arguments.append(Wasm::Value(static_cast<i64>(value)));
arguments.append(Wasm::Value(param, static_cast<u64>(value)));
break;
case Wasm::ValueType::Kind::F32:
arguments.append(Wasm::Value(static_cast<float>(value)));