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/mem/Allocator.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/mem/Allocator.zig')
| -rw-r--r-- | lib/std/mem/Allocator.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index b402fab3fa..5110534ed4 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -307,14 +307,14 @@ pub fn free(self: Allocator, memory: anytype) void { /// Copies `m` to newly allocated memory. Caller owns the memory. pub fn dupe(allocator: Allocator, comptime T: type, m: []const T) ![]T { const new_buf = try allocator.alloc(T, m.len); - mem.copy(T, new_buf, m); + @memcpy(new_buf, m); return new_buf; } /// Copies `m` to newly allocated memory, with a null-terminated element. Caller owns the memory. pub fn dupeZ(allocator: Allocator, comptime T: type, m: []const T) ![:0]T { const new_buf = try allocator.alloc(T, m.len + 1); - mem.copy(T, new_buf, m); + @memcpy(new_buf[0..m.len], m); new_buf[m.len] = 0; return new_buf[0..m.len :0]; } |
