Function intConst [src]

Prototype

pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant

Parameters

self: *Builderty: Type

Source

pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant { const int_value = switch (@typeInfo(@TypeOf(value))) { .int, .comptime_int => value, .@"enum" => @intFromEnum(value), else => @compileError("intConst expected an integral value, got " ++ @typeName(@TypeOf(value))), }; var limbs: [ switch (@typeInfo(@TypeOf(int_value))) { .int => |info| std.math.big.int.calcTwosCompLimbCount(info.bits), .comptime_int => std.math.big.int.calcLimbLen(int_value), else => unreachable, } ]std.math.big.Limb = undefined; return self.bigIntConst(ty, std.math.big.int.Mutable.init(&limbs, int_value).toConst()); }