Compare commits
No commits in common. "c1388c731820d9847c9d54f698c55e07752bc5ea" and "d5e66caf2180324d83ad9be30e887849f5ed74da" have entirely different histories.
c1388c7318
...
d5e66caf21
11
build.zig
11
build.zig
|
@ -27,21 +27,18 @@ pub fn build(b: *std.Build) void {
|
||||||
// This declares intent for the library to be installed into the standard
|
// This declares intent for the library to be installed into the standard
|
||||||
// location when the user invokes the "install" step (the default step when
|
// location when the user invokes the "install" step (the default step when
|
||||||
// running `zig build`).
|
// running `zig build`).
|
||||||
b.installArtifact(lib);
|
lib.install();
|
||||||
|
|
||||||
// Creates a step for unit testing. This only builds the test executable
|
// Creates a step for unit testing.
|
||||||
// but does not run it.
|
|
||||||
const main_tests = b.addTest(.{
|
const main_tests = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "src/lib.zig" },
|
.root_source_file = .{ .path = "src/main.zig" },
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const run_main_tests = b.addRunArtifact(main_tests);
|
|
||||||
|
|
||||||
// This creates a build step. It will be visible in the `zig build --help` menu,
|
// This creates a build step. It will be visible in the `zig build --help` menu,
|
||||||
// and can be selected like this: `zig build test`
|
// and can be selected like this: `zig build test`
|
||||||
// This will evaluate the `test` step rather than the default, which is "install".
|
// This will evaluate the `test` step rather than the default, which is "install".
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&run_main_tests.step);
|
test_step.dependOn(&main_tests.step);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ pub fn RingBuffer(comptime T: type) type {
|
||||||
std.debug.assert(std.math.isPowerOfTwo(buf.len)); // capacity must be a power of two
|
std.debug.assert(std.math.isPowerOfTwo(buf.len)); // capacity must be a power of two
|
||||||
std.debug.assert(buf.len <= max_capacity);
|
std.debug.assert(buf.len <= max_capacity);
|
||||||
|
|
||||||
@memset(buf, 0);
|
std.mem.set(T, buf, 0);
|
||||||
|
|
||||||
return .{ .read = 0, .write = 0, .buf = buf };
|
return .{ .read = 0, .write = 0, .buf = buf };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue