zahl

Log | Files | Refs | README

commit 8b3d2da6ce853b855d4dbc872547ef1fea75160d
parent fb96795852df56d9489e898e44dcb7e5fea98760
Author: Thomas Vigouroux <thomas.vigouroux@univ-grenoble-alpes.fr>
Date:   Fri, 14 Jun 2024 13:43:02 +0200

feat(compile): allow arbitrary size integers

Leverage comptime to build the integer to be checked against

Diffstat:
Msrc/compile.zig | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/compile.zig b/src/compile.zig @@ -106,11 +106,11 @@ pub const Compiler = struct { return false; } - // FIXME: create a const here and check that ? That'll avoid a conversion + const llen: usize = comptime std.math.big.int.calcLimbLen(desc); + var limbbuf: [llen]std.math.big.Limb = undefined; + var mut = std.math.big.int.Mutable.init(&limbbuf, desc).toConst(); - const tocheck = val.val.number.to(isize) catch return false; - - return tocheck == desc; + return mut.eql(val.val.number.toConst()); }, .EnumLiteral => { if (desc == .any) {