Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1e571b4

Browse files
Use TypedArray.set to copy a bunch of bytes
1 parent c2df543 commit 1e571b4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

‎Runtime/src/index.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,7 @@ export class SwiftRuntime {
222222

223223
const writeString = (ptr: pointer, bytes: Uint8Array) => {
224224
const uint8Memory = new Uint8Array(memory().buffer);
225-
for (const [index, byte] of bytes.entries()) {
226-
uint8Memory[ptr + index] = byte;
227-
}
228-
uint8Memory[ptr];
225+
uint8Memory.set(bytes, ptr);
229226
};
230227

231228
const readUInt32 = (ptr: pointer) => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /