Quellcode durchsuchen

LibWeb: Use SignedBigInteger::create() to create wasm i64 values

...instead of the terrible from_base10(...to_base10()) hack.
Ali Mohammad Pur vor 4 Jahren
Ursprung
Commit
a256997064
1 geänderte Dateien mit 1 neuen und 2 gelöschten Zeilen
  1. 1 2
      Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp

+ 1 - 2
Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp

@@ -251,8 +251,7 @@ JS::Value to_js_value(Wasm::Value& wasm_value, JS::GlobalObject& global_object)
 {
 {
     switch (wasm_value.type().kind()) {
     switch (wasm_value.type().kind()) {
     case Wasm::ValueType::I64:
     case Wasm::ValueType::I64:
-        // FIXME: This is extremely silly...
-        return global_object.heap().allocate<JS::BigInt>(global_object, Crypto::SignedBigInteger::from_base10(String::number(wasm_value.to<i64>().value())));
+        return global_object.heap().allocate<JS::BigInt>(global_object, Crypto::SignedBigInteger::create_from(wasm_value.to<i64>().value()));
     case Wasm::ValueType::I32:
     case Wasm::ValueType::I32:
         return JS::Value(wasm_value.to<i32>().value());
         return JS::Value(wasm_value.to<i32>().value());
     case Wasm::ValueType::F64:
     case Wasm::ValueType::F64: