commit 06c08e5219f03328f483cded319c7ba75efb5188 (tree)
parent 37647375dcb817f88895ba1a17d648184727e4cc
Author: Vexu <git@vexu.eu>
Date: Thu, 16 Jul 2020 17:05:14 +0300
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
@@ -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;