Skip to content

Commit 3e082ac

Browse files
authored
Merge pull request #5 from TUSF/zig-0.14.0
Zig 0.14.0
2 parents fb86bb8 + 9dff05a commit 3e082ac

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

build.zig.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.{
2-
.name = "zigfp",
2+
.name = .zigfp,
33
.version = "0.0.1",
4-
5-
.minimum_zig_version = "0.13.0",
4+
.fingerprint = 0x1d54d742143d3f65,
5+
.minimum_zig_version = "0.14.0",
66

77
.paths = .{
88
"build.zig",

src/main.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const std = @import("std");
44
pub const i32p10 = FixedPoint(32, 1024);
55

66
/// medium range, medium precision fixed point value between -32000 and +32000, with a precision of roughly 0.000015
7-
pub const i32p64 = FixedPoint(32, 65536);
7+
pub const i32p16 = FixedPoint(32, 65536);
88

99
/// high precision fixed point with i32 integer range and a precision of roughly 0.00000000025
1010
pub const i64p32 = FixedPoint(64, 1 << 32);
@@ -16,10 +16,10 @@ pub fn FixedPoint(comptime bits: comptime_int, comptime scaling: comptime_int) t
1616
if (scaling < 1)
1717
@compileError("scaling must be a positive, non-zero integer!");
1818
const BaseInt = @Type(.{
19-
.Int = .{ .bits = bits, .signedness = .signed },
19+
.int = .{ .bits = bits, .signedness = .signed },
2020
});
2121
const BaseIntUnsigned = @Type(.{
22-
.Int = .{ .bits = bits - 1, .signedness = .unsigned },
22+
.int = .{ .bits = bits - 1, .signedness = .unsigned },
2323
});
2424
if (scaling > std.math.maxInt(BaseInt))
2525
@compileError(std.fmt.comptimePrint("scaling must be less than {}", .{std.math.maxInt(BaseInt)}));
@@ -32,11 +32,11 @@ pub fn FixedPoint(comptime bits: comptime_int, comptime scaling: comptime_int) t
3232
pub const Int = BaseInt;
3333

3434
pub const Int2 = @Type(.{
35-
.Int = .{ .bits = 2 * bits, .signedness = .signed },
35+
.int = .{ .bits = 2 * bits, .signedness = .signed },
3636
});
3737

3838
pub const IntPart = @Type(.{
39-
.Int = .{ .bits = bits - scaling_bits_max, .signedness = .signed },
39+
.int = .{ .bits = bits - scaling_bits_max, .signedness = .signed },
4040
});
4141

4242
pub const precision = 2.0 / @as(comptime_float, scaling);
@@ -58,7 +58,7 @@ pub fn FixedPoint(comptime bits: comptime_int, comptime scaling: comptime_int) t
5858

5959
pub fn toFloat(v: F, comptime T: type) T {
6060
// std.debug.print("toFloat({}, {})\n", .{ Int, v.raw });
61-
_ = @typeInfo(T).Float;
61+
_ = @typeInfo(T).float;
6262
return @as(T, @floatFromInt(v.raw)) / scaling;
6363
}
6464

@@ -169,7 +169,7 @@ pub fn FixedPoint(comptime bits: comptime_int, comptime scaling: comptime_int) t
169169

170170
test {
171171
_ = TestSuite(i32p10);
172-
_ = TestSuite(i32p64);
172+
_ = TestSuite(i32p16);
173173
_ = TestSuite(i64p32);
174174
_ = TestSuite(FixedPoint(32, 1000));
175175
_ = TestSuite(FixedPoint(64, 1000));

0 commit comments

Comments
 (0)