fix(gen-zig): @intCast runtime shift amounts; pin bare-literal shift LHS - #1933
Merged
Conversation
Closes #1932 Zig requires the shift RHS to be Log2(LHS-width)-typed (u5 for u32) and a fixed-width LHS when the amount is runtime-known. gen-zig emitted both raw, blocking 13 tri-net specs (the tri_* crypto line among them): - runtime amounts now emit `@intCast(rhs)` - a bare integer-literal LHS under a runtime amount pins `@as(u32, lit)` (u64 when the literal exceeds u32) - literal amounts stay untouched, so existing gens remain byte-identical tri-net corpus: both shift error classes gone; 6 specs newly pass zig test end-to-end, 7 advance to their runtime layer (checked-add overflow in hash mixing -- the documented spec-side +% idiom). FROZEN_HASH resealed; only unit red is the pre-existing bitnet_layer iverilog test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
August 8, 2026 11:36
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1932
Third Zig emission class from the #1928 ledger. Zig wants the shift RHS Log2-typed (u5 for u32) and a fixed-width LHS when the amount is runtime-known; gen-zig emitted both raw, blocking 13 tri-net specs including the tri_* crypto line.
@intCast(rhs); bare-literal LHS under a runtime amount →@as(u32, lit)(u64 above u32 range)tri-net corpus: 6 specs newly pass
zig testend-to-end (packet_loss_injection, tri_a2a_card, tri_compute_gfvalid, tri_gft_ladder, tri_gft_add, tri_gft_sub), 7 advance to their runtime layer (checked-add overflow in hash mixing — the spec-side+%idiom, tracked tri-net-side). Unit suite: only pre-existing red is bitnet_layer (iverilog, fails on pristine master). FROZEN_HASH resealed; NOW.md entries added.🤖 Generated with Claude Code