fix zig breakage
This commit is contained in:
parent
40fc6a8d41
commit
1bbdcd3e40
2 changed files with 17 additions and 20 deletions
20
build.zig
20
build.zig
|
@ -17,19 +17,19 @@ pub fn build(b: *std.Build) void {
|
|||
_ = b.addModule(
|
||||
"datetime",
|
||||
.{
|
||||
.source_file = .{
|
||||
.path = "src/main.zig",
|
||||
},
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
},
|
||||
);
|
||||
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "datetime",
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
b.installArtifact(lib);
|
||||
// const lib = b.addStaticLibrary(.{
|
||||
// .name = "datetime",
|
||||
// .root_source_file = .{ .path = "src/main.zig" },
|
||||
// .target = target,
|
||||
// .optimize = optimize,
|
||||
// });
|
||||
// b.installArtifact(lib);
|
||||
|
||||
const main_tests = b.addTest(.{
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
|
|
17
src/main.zig
17
src/main.zig
|
@ -1452,9 +1452,8 @@ test "asDateTime" {
|
|||
pub fn isLeap(year: Year) bool {
|
||||
// taken from https://github.com/ziglang/zig/pull/18451
|
||||
|
||||
// In the western Gregorian Calendar leap a year is
|
||||
// a multiple of 4, excluding multiples of 100, and
|
||||
// adding multiples of 400. In code:
|
||||
// In the western Gregorian Calendar leap a year is a multiple of 4,
|
||||
// excluding multiples of 100, and adding multiples of 400. In code:
|
||||
//
|
||||
// if (@mod(year, 4) != 0)
|
||||
// return false;
|
||||
|
@ -1462,14 +1461,12 @@ pub fn isLeap(year: Year) bool {
|
|||
// return true;
|
||||
// return (0 == @mod(year, 400));
|
||||
|
||||
// The following is equivalent to the above
|
||||
// but uses bitwise operations when testing
|
||||
// for divisibility, masking with 3 as test
|
||||
// for multiples of 4 and with 15 as a test
|
||||
// for multiples of 16. Multiples of 16 and
|
||||
// 100 are, conveniently, multiples of 400.
|
||||
// The following is equivalent to the above but uses bitwise operations
|
||||
// when testing for divisibility, masking with 3 as test for multiples of 4
|
||||
// and with 15 as a test for multiples of 16. Multiples of 16 and 100 are,
|
||||
// conveniently, multiples of 400.
|
||||
|
||||
const mask: Year = switch (year % 100) {
|
||||
const mask: Year = switch (@mod(year, 100)) {
|
||||
0 => 0b1111,
|
||||
else => 0b11,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue