mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
mem.zeroes .Array improvements
Before (when given an array with many elements):
```
zig\std\mem.zig:345:13: error: evaluation exceeded 1000
backwards branches
for (array) |*element| {
^
```
related to https://github.com/ziglang/zig/issues/4847#issuecomment-605721461
This commit is contained in:
parent
3be720a729
commit
ef419dd72d
@ -341,11 +341,7 @@ pub fn zeroes(comptime T: type) T {
|
||||
}
|
||||
},
|
||||
.Array => |info| {
|
||||
var array: T = undefined;
|
||||
for (array) |*element| {
|
||||
element.* = zeroes(info.child);
|
||||
}
|
||||
return array;
|
||||
return [_]info.child{zeroes(info.child)} ** info.len;
|
||||
},
|
||||
.Vector,
|
||||
.ErrorUnion,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user