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 /lib/std/cstr.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 'lib/std/cstr.zig')
| -rw-r--r-- | lib/std/cstr.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/cstr.zig b/lib/std/cstr.zig index 52524c5084..8a203e5c8e 100644 --- a/lib/std/cstr.zig +++ b/lib/std/cstr.zig @@ -34,7 +34,7 @@ fn testCStrFnsImpl() !void { /// Caller owns the returned memory. pub fn addNullByte(allocator: mem.Allocator, slice: []const u8) ![:0]u8 { const result = try allocator.alloc(u8, slice.len + 1); - mem.copy(u8, result, slice); + @memcpy(result[0..slice.len], slice); result[slice.len] = 0; return result[0..slice.len :0]; } @@ -78,7 +78,7 @@ pub const NullTerminated2DArray = struct { for (slice) |inner| { index_buf[i] = buf.ptr + write_index; i += 1; - mem.copy(u8, buf[write_index..], inner); + @memcpy(buf[write_index..][0..inner.len], inner); write_index += inner.len; buf[write_index] = 0; write_index += 1; |
