From d7386eb36c32452d69a734b447015b4db23f1ac4 Mon Sep 17 00:00:00 2001 From: cician Date: Mon, 31 Jan 2022 21:27:25 +0100 Subject: [PATCH] fix(stdlib): Make Bytes.length handle sizes over 2GiB (#1123) --- stdlib/bytes.gr | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stdlib/bytes.gr b/stdlib/bytes.gr index e7460a0d59..692fc34289 100644 --- a/stdlib/bytes.gr +++ b/stdlib/bytes.gr @@ -12,11 +12,7 @@ import WasmI64 from "runtime/unsafe/wasmi64" import WasmF32 from "runtime/unsafe/wasmf32" import WasmF64 from "runtime/unsafe/wasmf64" import Conv from "runtime/unsafe/conv" -import { - tagSimpleNumber, - allocateBytes, - allocateString, -} from "runtime/dataStructures" +import { allocateBytes, allocateString } from "runtime/dataStructures" import Exception from "runtime/exception" import Int32 from "int32" import { coerceNumberToWasmI32 } from "runtime/numbers" @@ -151,7 +147,7 @@ export let rec toString = (bytes: Bytes) => { @disableGC export let rec length = (bytes: Bytes) => { let b = WasmI32.fromGrain(bytes) - let ret = tagSimpleNumber(getSize(b)) + let ret = Conv.wasmI32ToNumber(getSize(b)) Memory.decRef(WasmI32.fromGrain(bytes)) Memory.decRef(WasmI32.fromGrain(length)) ret