Skip to content

Commit d7386eb

Browse files
authored
fix(stdlib): Make Bytes.length handle sizes over 2GiB (#1123)
1 parent c4e1911 commit d7386eb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

stdlib/bytes.gr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ import WasmI64 from "runtime/unsafe/wasmi64"
1212
import WasmF32 from "runtime/unsafe/wasmf32"
1313
import WasmF64 from "runtime/unsafe/wasmf64"
1414
import Conv from "runtime/unsafe/conv"
15-
import {
16-
tagSimpleNumber,
17-
allocateBytes,
18-
allocateString,
19-
} from "runtime/dataStructures"
15+
import { allocateBytes, allocateString } from "runtime/dataStructures"
2016
import Exception from "runtime/exception"
2117
import Int32 from "int32"
2218
import { coerceNumberToWasmI32 } from "runtime/numbers"
@@ -151,7 +147,7 @@ export let rec toString = (bytes: Bytes) => {
151147
@disableGC
152148
export let rec length = (bytes: Bytes) => {
153149
let b = WasmI32.fromGrain(bytes)
154-
let ret = tagSimpleNumber(getSize(b))
150+
let ret = Conv.wasmI32ToNumber(getSize(b))
155151
Memory.decRef(WasmI32.fromGrain(bytes))
156152
Memory.decRef(WasmI32.fromGrain(length))
157153
ret

0 commit comments

Comments
 (0)