summaryrefslogtreecommitdiff
path: root/util/mem.zig
diff options
context:
space:
mode:
authorChristian Segundo2022-12-05 17:00:08 +0100
committerChristian Segundo2022-12-05 22:16:11 +0100
commit061a5bae272f45db6dcde99746922735f9769d25 (patch)
treee4dd9b6d903930c5c1b76286b4a08beea6f59162 /util/mem.zig
parent8817203517907ef4248bde7474e6fb566515d6a7 (diff)
downloadadvent-of-zig-2022-061a5bae272f45db6dcde99746922735f9769d25.tar.gz
add day 5
Diffstat (limited to 'util/mem.zig')
-rw-r--r--util/mem.zig19
1 files changed, 0 insertions, 19 deletions
diff --git a/util/mem.zig b/util/mem.zig
deleted file mode 100644
index 728db44..0000000
--- a/util/mem.zig
+++ /dev/null
@@ -1,19 +0,0 @@
-const std = @import("std");
-
-const math = std.math;
-const testing_allocator = std.testing.allocator;
-
-/// 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;
-}