From b823a49b6a57bc1736b33a0816b42aaaf86cf839 Mon Sep 17 00:00:00 2001 From: Sam Atman Date: Fri, 6 Feb 2026 13:07:03 -0500 Subject: zg module, casing improvements --- src/CanonData.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/CanonData.zig') 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 { s2: []const @import("canon").Canonicalization = undefined, }; +// Canonicalization looks like this: +// const Canonicalization = struct { +// len: u3 = 0, +// cps: [2]u21 = [_]u21{0} ** 2, +// }; + const canon_data = canon_data: { const canon_ = @import("canon"); break :canon_data Data{ @@ -17,7 +23,7 @@ const CanonData = @This(); // There's a bug here, which is down to how static u21 vs. runtime are handled, // the "unique representation" claim is not working out. AutoHash casts to bytes, -// and that won't fly. So we do this: +// and that won't fly. So we do a simple custom context which works for both. const Context = struct { pub fn hash(_: Context, cps: [2]u21) u64 { @@ -52,3 +58,7 @@ const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const comptime_map = @import("comptime_map.zig"); + +test { + _ = comptime_map; +} -- cgit v1.2.3