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/tar.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/tar.zig')
| -rw-r--r-- | lib/std/tar.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/std/tar.zig b/lib/std/tar.zig index ec668d5f93..c570c8e09c 100644 --- a/lib/std/tar.zig +++ b/lib/std/tar.zig @@ -55,9 +55,9 @@ pub const Header = struct { const p = prefix(header); if (p.len == 0) return n; - std.mem.copy(u8, buffer[0..p.len], p); + @memcpy(buffer[0..p.len], p); buffer[p.len] = '/'; - std.mem.copy(u8, buffer[p.len + 1 ..], n); + @memcpy(buffer[p.len + 1 ..][0..n.len], n); return buffer[0 .. p.len + 1 + n.len]; } @@ -101,8 +101,9 @@ pub fn pipeToFileSystem(dir: std.fs.Dir, reader: anytype, options: Options) !voi var end: usize = 0; header: while (true) { if (buffer.len - start < 1024) { - std.mem.copy(u8, &buffer, buffer[start..end]); - end -= start; + const dest_end = end - start; + @memcpy(buffer[0..dest_end], buffer[start..end]); + end = dest_end; start = 0; } const ask_header = @min(buffer.len - end, 1024 -| (end - start)); @@ -138,8 +139,9 @@ pub fn pipeToFileSystem(dir: std.fs.Dir, reader: anytype, options: Options) !voi var file_off: usize = 0; while (true) { if (buffer.len - start < 1024) { - std.mem.copy(u8, &buffer, buffer[start..end]); - end -= start; + const dest_end = end - start; + @memcpy(buffer[0..dest_end], buffer[start..end]); + end = dest_end; start = 0; } // Ask for the rounded up file size + 512 for the next header. |
