diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-26 10:01:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-26 10:01:54 -0700 |
| commit | 3c66850e4296ce2e0f9e0d25bc537aa489f4603e (patch) | |
| tree | ae4b78d3e1ee15253ee353a8c9d972a1034f6fc6 /lib/std/array_hash_map.zig | |
| parent | d0311e28b397d173f0d60c403985047ec952a172 (diff) | |
| parent | badad16f88ac7e1eb84eadf76e13b4dc346d4ced (diff) | |
| download | zig-3c66850e4296ce2e0f9e0d25bc537aa489f4603e.tar.gz zig-3c66850e4296ce2e0f9e0d25bc537aa489f4603e.zip | |
Merge pull request #15278 from ziglang/memcpy-memset
change semantics of `@memcpy` and `@memset`
Diffstat (limited to 'lib/std/array_hash_map.zig')
| -rw-r--r-- | lib/std/array_hash_map.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig index 04b4e96cd5..bf43f24bc0 100644 --- a/lib/std/array_hash_map.zig +++ b/lib/std/array_hash_map.zig @@ -1893,7 +1893,7 @@ const IndexHeader = struct { const index_size = hash_map.capacityIndexSize(new_bit_index); const nbytes = @sizeOf(IndexHeader) + index_size * len; const bytes = try allocator.alignedAlloc(u8, @alignOf(IndexHeader), nbytes); - @memset(bytes.ptr + @sizeOf(IndexHeader), 0xff, bytes.len - @sizeOf(IndexHeader)); + @memset(bytes[@sizeOf(IndexHeader)..], 0xff); const result = @ptrCast(*IndexHeader, bytes.ptr); result.* = .{ .bit_index = new_bit_index, @@ -1914,7 +1914,7 @@ const IndexHeader = struct { const index_size = hash_map.capacityIndexSize(header.bit_index); const ptr = @ptrCast([*]align(@alignOf(IndexHeader)) u8, header); const nbytes = @sizeOf(IndexHeader) + header.length() * index_size; - @memset(ptr + @sizeOf(IndexHeader), 0xff, nbytes - @sizeOf(IndexHeader)); + @memset(ptr[@sizeOf(IndexHeader)..nbytes], 0xff); } // Verify that the header has sufficient alignment to produce aligned arrays. |
