Repository navigation
Use checked native paths for Nat powers and bit widths - #1713
Merged
Lorenzobattistela merged 3 commits intoOct 19, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Lorenzobattistela
approved these changes
Oct 19, 2026
Merged
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.
This adds C paths for Map.msb.u and U32.log2. Base, the checker and the JS backend are unchanged: a JS file runs Base's defs, as intr_of skips an op with no JS.
Map.msb.u computes the U32 width with CLZ, capped by the Nat fuel; zero fuel or zero input return 0. U32.log2 is 31 - CLZ(x | 1), so log2(0) stays 0. Map.msb.u sits on Map.diff.chr, the per-character step of string key comparison.
(Linux x64, nine-pair medians; fixture in #1708.)
tests/run/native_numeric_boundaries.bend checks zero, bit boundaries and fuel 0/1/31/32/99 on every lane.
The Nat.pow native was dropped in review: any base >= 2 hits the 48-bit Nat wall by exponent 47, so Base's linear def already takes at most 48 steps, and nothing outside tests calls it.
Fixes #1709
Fixes #1710