diff options
| author | Taylan Kammer <taylan.kammer@gmail.com> | 2025-03-18 21:39:51 +0100 |
|---|---|---|
| committer | Taylan Kammer <taylan.kammer@gmail.com> | 2025-03-18 21:39:51 +0100 |
| commit | f1c256884b0d59683e8bd43160b048561191a809 (patch) | |
| tree | 804f356fccb0e1a2b77f61e25bc81cbfc2452b03 /src/libzisp/value/fixnum.zig | |
| parent | c43c3c22e5d0f872168c5b687141c7b08a188c5d (diff) | |
Implement istr.
Diffstat (limited to 'src/libzisp/value/fixnum.zig')
| -rw-r--r-- | src/libzisp/value/fixnum.zig | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libzisp/value/fixnum.zig b/src/libzisp/value/fixnum.zig index c705880..80fb4ae 100644 --- a/src/libzisp/value/fixnum.zig +++ b/src/libzisp/value/fixnum.zig @@ -19,19 +19,15 @@ pub fn assert(v: Value) void { } // See detailed NaN packing docs for why the +/- 1. -const fixnum_min = std.math.minInt(i52) + 1; -const fixnum_max = std.math.maxInt(i52) - 1; - -pub fn isValidRange(int: i64) bool { - return fixnum_min < int and int < fixnum_max; -} +pub const min = std.math.minInt(i52) + 1; +pub const max = std.math.maxInt(i52) - 1; fn assertValidRange(int: i64) void { - if (int < fixnum_min) { + if (int < min) { std.debug.print("int too small for fixnum: {}\n", .{int}); @panic("int too small for fixnum"); } - if (int > fixnum_max) { + if (int > max) { std.debug.print("int too large for fixnum: {}\n", .{int}); @panic("int too large for fixnum"); } |
