4 ms·
Very cool! Suggestion for ergonomics: #[cfg(target_arch = "x86")] use std::arch::x86::* as simd; #[cfg(target_arch = "x86_64")] use std::arch::x86_64:
by arcticbull 4y ago
Very cool!
Suggestion for ergonomics:
#[cfg(target_arch = "x86")]
use std::arch::x86::* as simd;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::* as simd;
Then you can just use `simd::intrinsic` and you get the one appropriate to your platform.
A little extra typing at point of use but solves editor slowness issues and automatically adding imports issue.
- saghm 4y agoShould there be a wildcard at the end of those imports? I've never seen that before and would expect to just alias the module. I'm not sure what aliasing the wildcard import could mean.
- arcticbull 4y agoOops! Sorry, you're right, there should not. #[cfg(target_arch = "x86")] use std::arch::x86 as simd; #[cfg(target_arch = "x86_64")] use std::arch::x86_64 as simd; ... is what I meant. Too late to edit now.