feature. See also
. The project being documented here (as the example) is the Zig library itself.
convert_fast.fastIntPow10
fn fastIntPow10(comptime T: type, i: usize) T
File
Code
fn fastIntPow10(comptime T: type, i: usize) T {
return switch (T) {
u64 => ([16]u64{
1, 10, 100, 1000,
10000, 100000, 1000000, 10000000,
100000000, 1000000000, 10000000000, 100000000000,
1000000000000, 10000000000000, 100000000000000, 1000000000000000,
})[i],
u128 => ([35]u128{
1, 10,
100, 1000,
10000, 100000,
1000000, 10000000,
100000000, 1000000000,
10000000000, 100000000000,
1000000000000, 10000000000000,
100000000000000, 1000000000000000,
10000000000000000, 100000000000000000,
1000000000000000000, 10000000000000000000,
100000000000000000000, 1000000000000000000000,
10000000000000000000000, 100000000000000000000000,
1000000000000000000000000, 10000000000000000000000000,
100000000000000000000000000, 1000000000000000000000000000,
10000000000000000000000000000, 100000000000000000000000000000,
1000000000000000000000000000000, 10000000000000000000000000000000,
100000000000000000000000000000000, 1000000000000000000000000000000000,
10000000000000000000000000000000000,
})[i],
else => unreachable,
};
}