cpufeatures: `cfg_select!`-like macro
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- performance
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.
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.
- Dominant language
- Rust
- Stars
- 674
- Forks
- 170
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 10
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.
More from RustCrypto/utils
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RustCrypto/utils#1546 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
RustCrypto/utils#1537 · 7 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
RustCrypto/utils#1534 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
RustCrypto/utils#1510 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
RustCrypto/utils#1509 ·
All issues in RustCrypto/utils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BurntSushi/jiff#653 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ZcashFoundation/zeeder#106 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
oxidize-rb/rb-sys#807 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
todo:ticket
Difficulty 2/5 1-2 days Newbie friendliness 74/100