diff options
Diffstat (limited to 'day-2/util/mem.zig')
-rw-r--r-- | day-2/util/mem.zig | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/day-2/util/mem.zig b/day-2/util/mem.zig deleted file mode 100644 index 89ba67b..0000000 --- a/day-2/util/mem.zig +++ /dev/null @@ -1,17 +0,0 @@ -const std = @import("std"); -const math = std.math; - -/// Returns the position of the smallest number in a slice. -pub fn min_idx(comptime T: type, slice: []const T) usize { - var best = slice[0]; - var idx: usize = 0; - - for (slice[1..]) |item, i| { - const possible_best = math.min(best, item); - if (best > possible_best) { - best = possible_best; - idx = i + 1; - } - } - return idx; -} |