Skip to content

docs(builtin): expand documentation for Int::clz and sign predicates - #4165

Merged
bobzhang merged 1 commit into
moonbitlang:mainfrom
0717lee:docs/builtin-clz-sign-predicates
Aug 29, 2026
Merged

docs(builtin): expand documentation for Int::clz and sign predicates#4165
bobzhang merged 1 commit into
moonbitlang:mainfrom
0717lee:docs/builtin-clz-sign-predicates

Conversation

@0717lee

@0717lee 0717lee commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Part of #623 (improve comment coverage for builtin).

Int::clz, Int::is_pos, Int::is_non_pos and Int::is_non_neg currently 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:

  • semantics and parameters
  • return behavior including the boundary cases (clz returns 0 to 32: 0 for a negative value whose sign bit is set, 32 for zero)
  • executable mbt check examples in the existing inspect style

Documentation-only change; no signatures or behavior are affected.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::clz with structured semantics/parameters/return behavior and mbt check examples.
  • Replaced the one-line docs for Int::is_pos, Int::is_non_pos, and Int::is_non_neg with structured descriptions and mbt check examples.
  • Documented key boundary behaviors (e.g., clz returning 32 for 0, returning 0 for 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.

@bobzhang
bobzhang merged commit f320759 into moonbitlang:main Aug 29, 2026
20 checks passed
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.

3 participants