feature. See also
. The project being documented here (as the example) is the Zig library itself.
Writer.printInt
pub inline fn printInt(
w: *Writer,
value: anytype,
base: u8,
case: std.fmt.Case,
options: std.fmt.Options,
) Error!void
File
Code
pub inline fn printInt(
w: *Writer,
value: anytype,
base: u8,
case: std.fmt.Case,
options: std.fmt.Options,
) Error!void {
switch (@TypeOf(value)) {
isize, usize => {},
comptime_int => {
if (comptime std.math.cast(usize, value)) |x| return printIntAny(w, x, base, case, options);
if (comptime std.math.cast(isize, value)) |x| return printIntAny(w, x, base, case, options);
const Int = std.math.IntFittingRange(value, value);
return printIntAny(w, @as(Int, value), base, case, options);
},
else => switch (@typeInfo(@TypeOf(value)).int.signedness) {
.signed => if (std.math.cast(isize, value)) |x| return printIntAny(w, x, base, case, options),
.unsigned => if (std.math.cast(usize, value)) |x| return printIntAny(w, x, base, case, options),
},
}
return printIntAny(w, value, base, case, options);
}