summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:51:08 -0300
committerGabriel Schneider <[email protected]>2026-11-05 09:54:56 -0300
commit2c1611695bc8897756c1168445c0d4f67a683049 (patch)
treedd0e381314c745314ed264053c54b5366a0a800a /src/tape.zig
parentfb00a8785df8050b6bd39851201c2ef8a506e926 (diff)
downloadpardes-2c1611695bc8897756c1168445c0d4f67a683049.tar.gz
pardes-2c1611695bc8897756c1168445c0d4f67a683049.zip
tape: a digest is recorded by one recordDigest (a step's end, a unit's, a batch's), where digestHere was the same function and leaveInput inlined it a third time
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/tape.zig b/src/tape.zig
index fe16406e..c4e36bcd 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -365,12 +365,7 @@ pub const Tape = struct {
t.wrap(core);
};
t.record(.done, void, &{});
- if ((t.depth == 0 or t.every) and !t.no_digest and !t.unit_digests) if (t.core) |core| {
- var parts: Parts = undefined;
- const whole = [1]u64{digestOf(core)};
- const d: []const u64 = if (t.whole_digest) &whole else digestParts(core, &parts);
- t.record(.digest, []const u64, &d);
- };
+ if ((t.depth == 0 or t.every) and !t.no_digest and !t.unit_digests) recordDigest(t);
if (t.depth == 0) t.flush();
t.seeFields();
}
@@ -948,8 +943,9 @@ fn guessed(comptime R: type, g: Guess) R {
@compileError("tape: no guess of a clock read as " ++ @typeName(R));
}
-/// The session's digest recorded now (a unit's end: the replica stream's
-/// one, `unit_digests`).
+/// The session's digest recorded now: at a step's end; at a unit's
+/// (`unit_digests`, the replica stream's); or a batch of steps recorded
+/// without one each (`no_digest`) checked once, at its end.
pub fn recordDigest(t: *Tape) void {
const core = t.core orelse return;
var parts: Parts = undefined;
@@ -1098,16 +1094,6 @@ pub fn release(t: *Tape) void {
if (t.kept_arena) |*k| k.deinit();
}
-/// The session's digest recorded now: a batch of steps recorded without
-/// one each (`no_digest`) checked once, at its end.
-pub fn digestHere(t: *Tape) void {
- const core = t.core orelse return;
- var parts: Parts = undefined;
- const whole = [1]u64{digestOf(core)};
- const d: []const u64 = if (t.whole_digest) &whole else digestParts(core, &parts);
- t.record(.digest, []const u64, &d);
-}
-
/// What was recorded since the last take; the tape's to reuse after.
pub fn taken(t: *Tape) []const u8 {
return t.buf.items;