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.
More than once I wrote a piece of code that has the following shape:
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.