diff --git a/std/assembly/util/string.ts b/std/assembly/util/string.ts index 6eed06e09f..0ae05927dc 100644 --- a/std/assembly/util/string.ts +++ b/std/assembly/util/string.ts @@ -551,7 +551,7 @@ export function isCaseIgnorable(c: u32): bool { // @ts-ignore: decorator @inline -export function isFinalSigma(buffer: usize, index: i32, len: i32): bool { +export function isFinalSigma(buffer: usize, index: isize, len: isize): bool { const lookaheadLimit = 30; // max lookahead limit var found = false; var pos = index; @@ -565,15 +565,15 @@ export function isFinalSigma(buffer: usize, index: i32, len: i32): bool { return false; } } - pos -= i32(c >= 0x10000) + 1; + pos -= isize(c >= 0x10000) + 1; } if (!found) return false; pos = index + 1; var maxPos = min(pos + lookaheadLimit, len); while (pos < maxPos) { - let c = load(buffer + (pos << 1)); + let c = load(buffer + (pos << 1)); if (u32((c & 0xFC00) == 0xD800) & u32(pos + 1 != len)) { - let c1 = load(buffer + (pos << 1), 2); + let c1 = load(buffer + (pos << 1), 2); if ((c1 & 0xFC00) == 0xDC00) { c = (c - 0xD800 << 10) + (c1 - 0xDC00) + 0x10000; } @@ -581,18 +581,18 @@ export function isFinalSigma(buffer: usize, index: i32, len: i32): bool { if (!isCaseIgnorable(c)) { return !isCased(c); } - pos += i32(c >= 0x10000) + 1; + pos += isize(c >= 0x10000) + 1; } return true; } // @ts-ignore: decorator @inline -function codePointBefore(buffer: usize, index: i32): i32 { +function codePointBefore(buffer: usize, index: isize): i32 { if (index <= 0) return -1; - var c = load(buffer + (index - 1 << 1)); + var c = load(buffer + (index - 1 << 1)); if (u32((c & 0xFC00) == 0xDC00) & u32(index - 2 >= 0)) { - let c1 = load(buffer + (index - 2 << 1)); + let c1 = load(buffer + (index - 2 << 1)); if ((c1 & 0xFC00) == 0xD800) { return ((c1 & 0x3FF) << 10) + (c & 0x3FF) + 0x10000; }