diff options
Diffstat (limited to 'src/CanonData.zig')
| -rw-r--r-- | src/CanonData.zig | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/CanonData.zig b/src/CanonData.zig index 5c1ffa6..144346c 100644 --- a/src/CanonData.zig +++ b/src/CanonData.zig | |||
| @@ -5,6 +5,12 @@ const Data = struct { | |||
| 5 | s2: []const @import("canon").Canonicalization = undefined, | 5 | s2: []const @import("canon").Canonicalization = undefined, |
| 6 | }; | 6 | }; |
| 7 | 7 | ||
| 8 | // Canonicalization looks like this: | ||
| 9 | // const Canonicalization = struct { | ||
| 10 | // len: u3 = 0, | ||
| 11 | // cps: [2]u21 = [_]u21{0} ** 2, | ||
| 12 | // }; | ||
| 13 | |||
| 8 | const canon_data = canon_data: { | 14 | const canon_data = canon_data: { |
| 9 | const canon_ = @import("canon"); | 15 | const canon_ = @import("canon"); |
| 10 | break :canon_data Data{ | 16 | break :canon_data Data{ |
| @@ -17,7 +23,7 @@ const CanonData = @This(); | |||
| 17 | 23 | ||
| 18 | // There's a bug here, which is down to how static u21 vs. runtime are handled, | 24 | // There's a bug here, which is down to how static u21 vs. runtime are handled, |
| 19 | // the "unique representation" claim is not working out. AutoHash casts to bytes, | 25 | // the "unique representation" claim is not working out. AutoHash casts to bytes, |
| 20 | // and that won't fly. So we do this: | 26 | // and that won't fly. So we do a simple custom context which works for both. |
| 21 | 27 | ||
| 22 | const Context = struct { | 28 | const Context = struct { |
| 23 | pub fn hash(_: Context, cps: [2]u21) u64 { | 29 | pub fn hash(_: Context, cps: [2]u21) u64 { |
| @@ -52,3 +58,7 @@ const std = @import("std"); | |||
| 52 | const builtin = @import("builtin"); | 58 | const builtin = @import("builtin"); |
| 53 | const mem = std.mem; | 59 | const mem = std.mem; |
| 54 | const comptime_map = @import("comptime_map.zig"); | 60 | const comptime_map = @import("comptime_map.zig"); |
| 61 | |||
| 62 | test { | ||
| 63 | _ = comptime_map; | ||
| 64 | } | ||