cpufeatures: `cfg_select!`-like macro
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 674
- Forks
- 170
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 10
Description
More than once I wrote a piece of code that has the following shape:
cpufeatures::new!(has_avx512f_vaes, "avx512f", "vaes");
if has_avx512f_vaes::get() {
return /* .. */;
}
cpufeatures::new!(has_avx2_vaes, "avx2", "vaes");
if has_avx2_vaes::get() {
return /* .. */;
}
cpufeatures::new!(has_aes_sse41, "aes", "sse4.1");
if has_aes_sse41::get() {
return /* .. */;
}
// Fallback
It'd be great to have something that can replace multiple individual atomic reads with a single one in such cases.
The shape of cfg_select! seems perfect for this.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the cpufeatures::new! entry point and compare the requested behavior with Rust's cfg_select! macro semantics. Trace how generated feature checks are read, then define and test an ordered selection interface that avoids repeated atomic reads and preserves the fallback; done when the requested feature combinations select the correct branch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100