From 209b48a36db527904ddc4b436f79df45cea3ab3e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 25 Aug 2026 21:42:56 -0300 Subject: Drop the dead std.fmt fallback in the emitter's integer writer Five digits is every u16, so the `v >= 10000` branch could never be taken and it was dragging `std.fmt.printInt` into a firmware whose whole reason for hand-rolling this was to keep the format machinery out of the hottest sequence it emits. Behaviour is identical, and re-verified rather than assumed: screen byte-identical to the vaxis reference on the 18-step workload, round trip median 3830 us over 60 trials (3829 before), snap 95/95, hxdiff 481/0, hxparity 561/0, unit-test. --- src/p4.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/p4.zig b/src/p4.zig index 0f23ddd5..5319ad90 100644 --- a/src/p4.zig +++ b/src/p4.zig @@ -722,8 +722,9 @@ fn cup(row: u16, col: u16) !void { try emitRaw(b[0..i]); } +/// Decimal, least significant digit first into a scratch buffer and then reversed. Five digits is +/// every `u16`, so there is no fallback to `std.fmt` and no value this cannot write. fn dec(buf: []u8, v: u16) usize { - if (v >= 10000) return std.fmt.printInt(buf, v, 10, .lower, .{}); var digits: [5]u8 = undefined; var n: usize = 0; var rest = v; -- cgit v1.3