• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / core / 6418
87%

Build:
DEFAULT BRANCH: main
Ran 31 Aug 2026 04:22AM UTC
Jobs 1
Files 451
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

31 Aug 2026 04:19AM UTC coverage: 90.929%. Remained the same
6418

push

github

web-flow
refactor(bigint): read each from_octets limb with a u32be pattern (#4099)

* refactor(bigint): read each limb with a u32be pattern in from_octets

The inner loop was a 4-iteration big-endian shift-accumulate, which is
exactly one u32be read (RADIX_BIT_LEN = 32).

Measured: native -34% at n=1024 / -24% at n=64, wasm-gc -46% / -42%.
js is unaffected (bigint_js.mbt has its own from_octets).

* bench(bigint): add from_octets benchmarks

Covers the limb-fill path at n=64 and n=1024 so the u32be conversion in
the previous commit is reproducible.

Signed-off-by: Codex CLI <codex@openai.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test(bigint): pin RADIX_BIT_LEN so the u32be limb read can't drift

Addresses the review note that `from_octets`'s tail now hard-codes a
32-bit read while `byte_per_limb` is still derived from `RADIX_BIT_LEN`.

Rather than branch on the constant at runtime, the assumption is pinned
by a whitebox test and named in the comment above the loop: narrowing
`RADIX_BIT_LEN` now fails a test instead of silently mis-decoding.

The pin uses `@test.assert_eq`, not `inspect`. A snapshot would be
rewritten by `moon test --update`, which would retire the guard at
exactly the moment it is supposed to fire; `assert_eq` is not
auto-updatable. Verified both halves by temporarily setting the expected
value to 16: the test fails with `32 != 16`, and `moon test --update`
leaves it failing rather than rewriting it.

A runtime fallback was considered and rejected. Restoring the old
shift-accumulate loop as the "generic" arm would not actually be generic:
`byte_per_limb` is `RADIX_BIT_LEN / 8`, so for the documented-legal
widths 4, 12, 20 and 28 (the file only requires a multiple of 4, at most
32) that loop truncates and mis-decodes just as badly. It would trade a
loud failure for a quiet one, plus a permanently dead branch that no test
can reach.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

S... (continued)

2 of 2 new or added lines in 1 file covered. (100.0%)

16760 of 18432 relevant lines covered (90.93%)

306289.44 hits per line

Jobs
ID Job ID Ran Files Coverage
1 6418.1 31 Aug 2026 04:22AM UTC 452
90.94
GitHub Action Run
Source Files on build 6418
  • Tree
  • List 451
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 8c2976dd on github
  • Prev Build on main (#6416)
  • Next Build on main (#6423)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc