fn pow10(comptime y: comptime_int) comptime_int y: comptime_int77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98fn pow10(comptime y: comptime_int) comptime_int {
if (y == 0) return 1;
var squaring = 0;
var s = 1;
while (s <= y) : (s <<= 1) {
squaring += 1;
}
squaring -= 1;
var result = 10;
for (0..squaring) |_| {
result *= result;
}
const rest_exp = y - (1 << squaring);
return result * pow10(rest_exp);
}