1 | /// Provides implementations of `From<$a> for $b` and `From<$b> for $a` that transmutes the value. |
2 | #[allow (unused)] |
3 | macro_rules! from_transmute { |
4 | { unsafe $a:ty => $b:ty } => { |
5 | from_transmute!{ @impl $a => $b } |
6 | from_transmute!{ @impl $b => $a } |
7 | }; |
8 | { @impl $from:ty => $to:ty } => { |
9 | impl core::convert::From<$from> for $to { |
10 | #[inline] |
11 | fn from(value: $from) -> $to { |
12 | // Safety: transmuting between vectors is safe, but the caller of this macro |
13 | // checks the invariants |
14 | unsafe { core::mem::transmute(value) } |
15 | } |
16 | } |
17 | }; |
18 | } |
19 | |
20 | /// Conversions to x86's SIMD types. |
21 | #[cfg (any(target_arch = "x86" , target_arch = "x86_64" ))] |
22 | mod x86; |
23 | |
24 | #[cfg (target_arch = "wasm32" )] |
25 | mod wasm32; |
26 | |
27 | #[cfg (any(target_arch = "aarch64" , target_arch = "arm64ec" , target_arch = "arm" ,))] |
28 | mod arm; |
29 | |
30 | #[cfg (any(target_arch = "powerpc" , target_arch = "powerpc64" ))] |
31 | mod powerpc; |
32 | |