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/os/linux | |
| 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/os/linux')
| -rw-r--r-- | lib/std/os/linux/bpf.zig | 2 | ||||
| -rw-r--r-- | lib/std/os/linux/io_uring.zig | 10 | ||||
| -rw-r--r-- | lib/std/os/linux/tls.zig | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/os/linux/bpf.zig b/lib/std/os/linux/bpf.zig index db6473d673..63b669acd5 100644 --- a/lib/std/os/linux/bpf.zig +++ b/lib/std/os/linux/bpf.zig @@ -1631,7 +1631,7 @@ test "map lookup, update, and delete" { const status = try map_get_next_key(map, &lookup_key, &next_key); try expectEqual(status, true); try expectEqual(next_key, key); - std.mem.copy(u8, &lookup_key, &next_key); + lookup_key = next_key; const status2 = try map_get_next_key(map, &lookup_key, &next_key); try expectEqual(status2, false); diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig index 20248fd65f..b7467d765f 100644 --- a/lib/std/os/linux/io_uring.zig +++ b/lib/std/os/linux/io_uring.zig @@ -1855,8 +1855,8 @@ test "write_fixed/read_fixed" { var raw_buffers: [2][11]u8 = undefined; // First buffer will be written to the file. - std.mem.set(u8, &raw_buffers[0], 'z'); - std.mem.copy(u8, &raw_buffers[0], "foobar"); + @memset(&raw_buffers[0], 'z'); + raw_buffers[0][0.."foobar".len].* = "foobar".*; var buffers = [2]os.iovec{ .{ .iov_base = &raw_buffers[0], .iov_len = raw_buffers[0].len }, @@ -2966,7 +2966,7 @@ test "provide_buffers: read" { // Provide 1 buffer again // Deliberately put something we don't expect in the buffers - mem.set(u8, mem.sliceAsBytes(&buffers), 42); + @memset(mem.sliceAsBytes(&buffers), 42); const reprovided_buffer_id = 2; @@ -3155,7 +3155,7 @@ test "provide_buffers: accept/connect/send/recv" { // Do 4 recv which should consume all buffers // Deliberately put something we don't expect in the buffers - mem.set(u8, mem.sliceAsBytes(&buffers), 1); + @memset(mem.sliceAsBytes(&buffers), 1); var i: usize = 0; while (i < buffers.len) : (i += 1) { @@ -3235,7 +3235,7 @@ test "provide_buffers: accept/connect/send/recv" { // Final recv which should work // Deliberately put something we don't expect in the buffers - mem.set(u8, mem.sliceAsBytes(&buffers), 1); + @memset(mem.sliceAsBytes(&buffers), 1); { var sqe = try ring.recv(0xdfdfdfdf, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0); diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index cffdec0424..311e5609e8 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -275,7 +275,7 @@ inline fn alignPtrCast(comptime T: type, ptr: [*]u8) *T { /// architecture-specific value of the thread-pointer register pub fn prepareTLS(area: []u8) usize { // Clear the area we're going to use, just to be safe - mem.set(u8, area, 0); + @memset(area, 0); // Prepare the DTV const dtv = alignPtrCast(DTV, area.ptr + tls_image.dtv_offset); dtv.entries = 1; @@ -287,7 +287,7 @@ pub fn prepareTLS(area: []u8) usize { .VariantII => area.ptr + tls_image.tcb_offset, }; // Copy the data - mem.copy(u8, area[tls_image.data_offset..], tls_image.init_data); + @memcpy(area[tls_image.data_offset..][0..tls_image.init_data.len], tls_image.init_data); // Return the corrected value (if needed) for the tp register. // Overflow here is not a problem, the pointer arithmetic involving the tp |
