Skip to content

fix: build on 32-bit targets (Calibrate's iteration bound) - #3

Merged
tannevaled merged 2 commits into
mainfrom
fix/32bit-maxiters
Nov 7, 2026
Merged

tannevaled merged 2 commits into
mainfrom
fix/32bit-maxiters

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

case.go:94: maxIters (untyped int constant 1099511627776) overflows int on GOARCH=386 and GOARCH=arm: found by go-dsp/signal#10's cross-compile and 386/arm lanes (v0.1.0 has no 32-bit lane of its own).

  • maxIters = min(1<<40, math.MaxInt>>1): unchanged on 64-bit targets.
  • The scaled iteration count is bounded in float64 before int(...) (a float outside int's range converts to an unspecified value).
  • Test: a body so fast that the scaled count exceeds the bound is refused with errNoTime.
  • Checked: GOOS=linux GOARCH=386|arm CGO_ENABLED=0 go test -c builds.

Needs a patch release (v0.1.1) for the dependents.

🤖 Generated with Claude Code

tannevaled and others added 2 commits November 7, 2026 21:23
maxIters = 1 << 40 does not fit an int on 386 and arm: the package failed to
compile there ("overflows int"), which broke every dependent's cross-compile
lanes (go-dsp/signal#10). The bound is now min(1<<40, MaxInt/2), and the scaled
count is bounded in float64 before the conversion to int.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit bc74a4b into main Nov 7, 2026
5 checks passed
@tannevaled
tannevaled deleted the fix/32bit-maxiters branch November 7, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant