docs(builtin): expand documentation for Int::clz and sign predicates - #4165
Merged
bobzhang merged 1 commit intoAug 29, 2026
Merged
Conversation
Bring `Int::clz`, `Int::is_pos`, `Int::is_non_pos` and `Int::is_non_neg` to the same documentation level as their documented siblings (`Int::ctz`, `Int::popcnt`, `Int::is_neg`): semantics, parameters, return behavior and executable examples. Part of moonbitlang#623
Contributor
There was a problem hiding this comment.
Pull request overview
Expands the built-in documentation for several Int intrinsics in builtin/intrinsics.mbt to match the more structured, example-driven style used by related Int methods (e.g., ctz, popcnt, is_neg), as part of improving comment coverage for builtin.
Changes:
- Replaced the one-line doc for
Int::clzwith structured semantics/parameters/return behavior andmbt checkexamples. - Replaced the one-line docs for
Int::is_pos,Int::is_non_pos, andInt::is_non_negwith structured descriptions andmbt checkexamples. - Documented key boundary behaviors (e.g.,
clzreturning32for0, returning0for negative values with MSB set).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Part of #623 (improve comment coverage for builtin).
Int::clz,Int::is_pos,Int::is_non_posandInt::is_non_negcurrently carry one-line comments while their documented siblings (Int::ctz,Int::popcnt,Int::is_neg) follow the full structure. This brings the four methods to the same level:clzreturns 0 to 32: 0 for a negative value whose sign bit is set, 32 for zero)mbt checkexamples in the existinginspectstyleDocumentation-only change; no signatures or behavior are affected.