zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ef419dd72d3fc9ec1454099367bd8d43f1b5037b (tree)
parent 3be720a729e20720a033f2cf1958311a0112d1f4
Author: Sebastian <15335529+Sobeston@users.noreply.github.com>
Date:   Mon, 30 Mar 2020 02:57:50 +0100

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
Diffstat:
Mlib/std/mem.zig | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/std/mem.zig b/lib/std/mem.zig @@ -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,