Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › zig › llvm › Builder › intConst Public Function intConst Doc Source Public Function std.zig.llvm.Builder.intConst
pub fn intConst (self : *Builder , ty : Type , value : anytype ) Allocator .Error !Constant Params File zig/llvm/Builder.zig: 10446
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460 pub fn intConst (self : *Builder , ty : Type , value : anytype ) Allocator .Error !Constant {
const int_value = switch (@typeInfo (@TypeOf (value ))) {
.int , .comptime_int => value ,
.@"enum" => @backingInt (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 ());
}