Skip to content

Commit abfef6d

Browse files
Use .subarray() instead of manually copying items
Co-authored-by: Max Graey <maxgraey@gmail.com>
1 parent 5d54b3c commit abfef6d

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/builtins.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,9 +3524,7 @@ function utf16ToUtf8(str: string) : Uint8Array {
35243524
result[utf8Length++] = 0x80 + (codePoint&0x3F);
35253525
}
35263526
}
3527-
let trimmed = new Uint8Array(utf8Length);
3528-
for (let i: i32 = 0; i < utf8Length; ++i) trimmed[i] = result[i];
3529-
return trimmed;
3527+
return result.subarray(0, utf8Length);
35303528
}
35313529

35323530
// memory.dataUTF8(value) -> usize

0 commit comments

Comments
 (0)