num: Implement uint_gather_scatter_bits feature for unsigned integers by okaneco · Pull Request #149097 · rust-lang/rust (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation12 Commits1 Checks11 Files changed

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

@okaneco

Feature gate: #![feature(uint_gather_scatter_bits)]
Tracking issue: #149069
Accepted ACP: rust-lang/libs-team#695 (comment)

Implement gather_bits, scatter_bits functions on unsigned integers
Add tests to coretests

This implementation is a small improvement over the plain naive form (see the solution sketch).
We only check the set bits in the mask instead of iterating over every bit.

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Nov 19, 2025

@rustbot

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

okaneco

quaternic

Choose a reason for hiding this comment

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

#[unstable(feature = "uint_gather_scatter_bits", issue = "149069")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]

Choose a reason for hiding this comment

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

#[inline(always)]
#[inline]

This seems more appropriate for something with a nontrivial amount of code within. Comparable to wrapping_pow.

Choose a reason for hiding this comment

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

Agree with this, and changed the function signatures to be mut param instead of redeclaring in the function body.

@okaneco

Implement gather_bits, scatter_bits functions on unsigned integers Add tests to coretests

@Mark-Simulacrum

@bors

📌 Commit 7f89192 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Nov 26, 2025

Zalathar added a commit to Zalathar/rust that referenced this pull request

Nov 26, 2025

@Zalathar

…k-Simulacrum

num: Implement uint_gather_scatter_bits feature for unsigned integers

Feature gate: #![feature(uint_gather_scatter_bits)] Tracking issue: rust-lang#149069 Accepted ACP: rust-lang/libs-team#695 (comment)

Implement gather_bits, scatter_bits functions on unsigned integers Add tests to coretests

This implementation is a small improvement over the plain naive form (see the solution sketch). We only check the set bits in the mask instead of iterating over every bit.

Zalathar added a commit to Zalathar/rust that referenced this pull request

Nov 26, 2025

@Zalathar

…k-Simulacrum

num: Implement uint_gather_scatter_bits feature for unsigned integers

Feature gate: #![feature(uint_gather_scatter_bits)] Tracking issue: rust-lang#149069 Accepted ACP: rust-lang/libs-team#695 (comment)

Implement gather_bits, scatter_bits functions on unsigned integers Add tests to coretests

This implementation is a small improvement over the plain naive form (see the solution sketch). We only check the set bits in the mask instead of iterating over every bit.

Zalathar added a commit to Zalathar/rust that referenced this pull request

Nov 26, 2025

@Zalathar

…k-Simulacrum

num: Implement uint_gather_scatter_bits feature for unsigned integers

Feature gate: #![feature(uint_gather_scatter_bits)] Tracking issue: rust-lang#149069 Accepted ACP: rust-lang/libs-team#695 (comment)

Implement gather_bits, scatter_bits functions on unsigned integers Add tests to coretests

This implementation is a small improvement over the plain naive form (see the solution sketch). We only check the set bits in the mask instead of iterating over every bit.

bors added a commit that referenced this pull request

Nov 26, 2025

@bors

Rollup of 19 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit that referenced this pull request

Nov 27, 2025

@bors

Rollup of 12 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit that referenced this pull request

Nov 27, 2025

@rust-timer

Rollup merge of #149097 - okaneco:gather_scatter_bits, r=Mark-Simulacrum

num: Implement uint_gather_scatter_bits feature for unsigned integers

Feature gate: #![feature(uint_gather_scatter_bits)] Tracking issue: #149069 Accepted ACP: rust-lang/libs-team#695 (comment)

Implement gather_bits, scatter_bits functions on unsigned integers Add tests to coretests

This implementation is a small improvement over the plain naive form (see the solution sketch). We only check the set bits in the mask instead of iterating over every bit.

@okaneco okaneco deleted the gather_scatter_bits branch

November 27, 2025 14:18

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.