diff options
Diffstat (limited to 'core/walk.zig')
| -rw-r--r-- | core/walk.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/walk.zig b/core/walk.zig index d870052d..898a7cf7 100644 --- a/core/walk.zig +++ b/core/walk.zig @@ -89,6 +89,15 @@ pub fn digest(comptime T: type, v: *const T) u64 { return h.final(); } +/// Equal as the digest sees them: what the walk leaves out (a Buf's bytes +/// past its length, a cache) is not compared. std.meta.eql compares every +/// byte of an array, and those bytes are undefined: 0xAA on every Debug +/// process, each release process's own garbage; a decision of the core +/// taken on them agrees between a session and its clients in Debug alone. +pub fn eql(comptime T: type, a: *const T, b: *const T) bool { + return digest(T, a) == digest(T, b); +} + /// A digest of each field `hash` would walk, in order (what a divergence /// is narrowed down by); `names` are theirs. pub fn fieldDigests(comptime T: type, v: *const T, out: []u64) []u64 { |
