diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-29 00:19:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 00:19:55 -0700 |
| commit | d65b42e07caa00dfe2f2fbf221c593ce57882784 (patch) | |
| tree | 7926cbea1499e0affe930bf6d7455dc24adf014e /src/link/Wasm.zig | |
| parent | fd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff) | |
| parent | fa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff) | |
| download | zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip | |
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'src/link/Wasm.zig')
| -rw-r--r-- | src/link/Wasm.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 0fe9ec5e3b..b6f4a4cc59 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -1976,7 +1976,7 @@ fn parseAtom(wasm: *Wasm, atom_index: Atom.Index, kind: Kind) !void { // We do not have to do this when exporting the memory (the default) because the runtime // will do it for us, and we do not emit the bss segment at all. if ((wasm.base.options.output_mode == .Obj or wasm.base.options.import_memory) and kind.data == .uninitialized) { - std.mem.set(u8, atom.code.items, 0); + @memset(atom.code.items, 0); } const should_merge = wasm.base.options.output_mode != .Obj; @@ -3852,7 +3852,10 @@ fn writeToFile( // Only when writing all sections executed properly we write the magic // bytes. This allows us to easily detect what went wrong while generating // the final binary. - mem.copy(u8, binary_bytes.items, &(std.wasm.magic ++ std.wasm.version)); + { + const src = std.wasm.magic ++ std.wasm.version; + binary_bytes.items[0..src.len].* = src; + } // finally, write the entire binary into the file. var iovec = [_]std.os.iovec_const{.{ @@ -4559,14 +4562,14 @@ fn writeVecSectionHeader(buffer: []u8, offset: u32, section: std.wasm.Section, s buf[0] = @enumToInt(section); leb.writeUnsignedFixed(5, buf[1..6], size); leb.writeUnsignedFixed(5, buf[6..], items); - mem.copy(u8, buffer[offset..], &buf); + buffer[offset..][0..buf.len].* = buf; } fn writeCustomSectionHeader(buffer: []u8, offset: u32, size: u32) !void { var buf: [1 + 5]u8 = undefined; buf[0] = 0; // 0 = 'custom' section leb.writeUnsignedFixed(5, buf[1..6], size); - mem.copy(u8, buffer[offset..], &buf); + buffer[offset..][0..buf.len].* = buf; } fn emitLinkSection(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: *std.AutoArrayHashMap(SymbolLoc, u32)) !void { |
