mirror of
https://codeberg.org/andyscott/exercism.git
synced 2024-12-22 14:43:10 -05:00
14 lines
301 B
Zig
14 lines
301 B
Zig
|
const std = @import("std");
|
||
|
|
||
|
pub const ChessboardError = error{IndexOutOfBounds};
|
||
|
|
||
|
pub fn square(index: usize) ChessboardError!u64 {
|
||
|
if (index > 64 or index < 1) return error.IndexOutOfBounds;
|
||
|
|
||
|
return std.math.pow(u64, 2, index - 1);
|
||
|
}
|
||
|
|
||
|
pub fn total() u64 {
|
||
|
return std.math.maxInt(u64);
|
||
|
}
|