about summary refs log tree commit diff
path: root/aoc/2021
diff options
context:
space:
mode:
Diffstat (limited to 'aoc/2021')
-rw-r--r--aoc/2021/08/part-two.zig7
1 files changed, 2 insertions, 5 deletions
diff --git a/aoc/2021/08/part-two.zig b/aoc/2021/08/part-two.zig
index 74db158..294e769 100644
--- a/aoc/2021/08/part-two.zig
+++ b/aoc/2021/08/part-two.zig
@@ -50,11 +50,8 @@ pub fn main() !void {
         while (output.next()) |s| : (pow /= 10) {
             var digit: u7 = 0;
             for (s) |c|
-                digit |= @as(u7, 1) << display[c - 'a'];
-            sum += pow * for (digits) |d, i| {
-                if (@bitReverse(u7, d) == digit) // edian
-                    break i;
-            } else unreachable;
+                digit |= @as(u7, 0b1000000) >> display[c - 'a'];
+            sum += pow * indexOfScalar(u7, digits[0..], digit).?;
         }
     }
 }