mirror of
https://github.com/ziglang/zig.git
synced 2026-01-05 13:03:25 +00:00
std.mem.zeroes use std.mem.set instead of @memset
stage1 comptime is not smart enough to remeber the size of the casted item which leads to out of bounds errors.
This commit is contained in:
parent
37647375dc
commit
06c08e5219
@ -552,7 +552,7 @@ pub fn zeroes(comptime T: type) T {
|
||||
if (@sizeOf(T) == 0) return T{};
|
||||
if (comptime meta.containerLayout(T) == .Extern) {
|
||||
var item: T = undefined;
|
||||
@memset(@ptrCast([*]u8, &item), 0, @sizeOf(T));
|
||||
set(u8, asBytes(&item), 0);
|
||||
return item;
|
||||
} else {
|
||||
var structure: T = undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user