Skip to content

Change as_words() to return fixed-size std::span#364

Merged
chfast merged 1 commit intomasterfrom
as_words_span
Jan 29, 2026
Merged

Change as_words() to return fixed-size std::span#364
chfast merged 1 commit intomasterfrom
as_words_span

Conversation

@chfast
Copy link
Copy Markdown
Owner

@chfast chfast commented Jan 29, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 29, 2026 16:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the as_words() API by changing it from returning raw pointers to returning fixed-size std::span objects, providing better type safety and compile-time size information.

Changes:

  • Modified as_words() template functions to return std::span<uint64_t, N> and std::span<const uint64_t, N> instead of raw pointers
  • Removed specialized uint128 overloads (now covered by the template)
  • Updated all call sites to use .data() where raw pointers are needed
  • Modernized test code to use std::ranges::generate with span's .subspan() method
  • Changed parameter type from int to size_t for better type safety

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
include/intx/intx.hpp Updated as_words() template functions to return fixed-size spans; removed redundant uint128 specializations; updated all usages to call .data() when raw pointers are needed
test/utils/random.cpp Added as_words() overload for uint64_t& returning std::span<uint64_t, 1>; modernized random generation to use std::ranges::generate with .subspan(); changed parameter type from int to size_t

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.71%. Comparing base (7f8c0f3) to head (7e8354d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #364      +/-   ##
==========================================
- Coverage   98.71%   98.71%   -0.01%     
==========================================
  Files          15       15              
  Lines        1867     1863       -4     
==========================================
- Hits         1843     1839       -4     
  Misses         24       24              
Flag Coverage Δ
32bit 98.69% <100.00%> (-0.01%) ⬇️
gcc 98.70% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/intx/intx.hpp 98.63% <100.00%> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast chfast merged commit b64000b into master Jan 29, 2026
28 checks passed
@chfast chfast deleted the as_words_span branch January 29, 2026 16:16
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.

2 participants