Skip to content

Commit 52ed327

Browse files
author
Jannis Pohlmann
committed
runtime/wasm: Make bigIntToString return a decimal string
1 parent 4d8ceb0 commit 52ed327

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

runtime/wasm/src/host_exports.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,8 @@ where
240240
format!("0x{}", ::hex::encode(bytes))
241241
}
242242

243-
pub(crate) fn big_int_to_string(
244-
&self,
245-
n: BigInt,
246-
) -> Result<String, HostExportError<impl ExportError>> {
247-
let bytes = n.to_bytes_le().1;
248-
self.bytes_to_string(bytes)
243+
pub(crate) fn big_int_to_string(&self, n: BigInt) -> String {
244+
format!("{}", n)
249245
}
250246

251247
pub(crate) fn big_int_to_hex(&self, n: BigInt) -> String {

runtime/wasm/src/module/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ where
333333
) -> Result<Option<RuntimeValue>, Trap> {
334334
let bytes: Vec<u8> = self.heap.asc_get(big_int_ptr);
335335
let n = BigInt::from_signed_bytes_le(&*bytes);
336-
let result = self.host_exports.big_int_to_string(n)?;
336+
let result = self.host_exports.big_int_to_string(n);
337337
Ok(Some(RuntimeValue::from(self.heap.asc_new(&result))))
338338
}
339339

0 commit comments

Comments
 (0)