diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-11 13:48:28 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 13:48:28 -0500 |
| commit | 4c1cc4d8d91af459e5ac1e20b744c7dc9b5b8da3 (patch) | |
| tree | 8ee7c3b7f2b4c66e9ed8599b9c5164b78d1cc43c /lib/std | |
| parent | 5fbae9cd6fe7a53d85ad6dd20cab75f7b835f0ad (diff) | |
| parent | 03b8206f27485f871fc489f884ffbc276d61877c (diff) | |
| download | zig-4c1cc4d8d91af459e5ac1e20b744c7dc9b5b8da3.tar.gz zig-4c1cc4d8d91af459e5ac1e20b744c7dc9b5b8da3.zip | |
Merge pull request #11120 from Vexu/stage2
Stage2: make std.rand tests pass
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/rand.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/rand.zig b/lib/std/rand.zig index 53b536f9ff..cfac15a1fb 100644 --- a/lib/std/rand.zig +++ b/lib/std/rand.zig @@ -7,6 +7,7 @@ //! TODO(tiehuis): Benchmark these against other reference implementations. const std = @import("std.zig"); +const builtin = @import("builtin"); const assert = std.debug.assert; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; @@ -30,7 +31,10 @@ pub const Sfc64 = @import("rand/Sfc64.zig"); pub const Random = struct { ptr: *anyopaque, - fillFn: fn (ptr: *anyopaque, buf: []u8) void, + fillFn: if (builtin.zig_backend == .stage1) + fn (ptr: *anyopaque, buf: []u8) void + else + *const fn (ptr: *anyopaque, buf: []u8) void, pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random { const Ptr = @TypeOf(pointer); |
