2021-07-19 17:01:28 -05:00
|
|
|
/// Provides implementations of `From<$a> for $b` and `From<$b> for $a` that transmutes the value.
|
2021-11-09 23:06:38 -06:00
|
|
|
#[allow(unused)]
|
2021-07-19 17:01:28 -05:00
|
|
|
macro_rules! from_transmute {
|
|
|
|
{ unsafe $a:ty => $b:ty } => {
|
|
|
|
from_transmute!{ @impl $a => $b }
|
|
|
|
from_transmute!{ @impl $b => $a }
|
|
|
|
};
|
|
|
|
{ @impl $from:ty => $to:ty } => {
|
|
|
|
impl core::convert::From<$from> for $to {
|
|
|
|
#[inline]
|
|
|
|
fn from(value: $from) -> $to {
|
2021-11-04 20:42:29 -05:00
|
|
|
// Safety: transmuting between vectors is safe, but the caller of this macro
|
|
|
|
// checks the invariants
|
2021-07-19 17:01:28 -05:00
|
|
|
unsafe { core::mem::transmute(value) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-12 18:42:48 -06:00
|
|
|
/// Conversions to x86's SIMD types.
|
2021-07-19 17:01:28 -05:00
|
|
|
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
|
|
|
mod x86;
|
|
|
|
|
|
|
|
#[cfg(any(target_arch = "wasm32"))]
|
|
|
|
mod wasm32;
|
|
|
|
|
2021-11-12 18:42:48 -06:00
|
|
|
#[cfg(any(target_arch = "aarch64", target_arch = "arm",))]
|
2021-07-19 17:01:28 -05:00
|
|
|
mod arm;
|
|
|
|
|
|
|
|
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
|
|
|
|
mod powerpc;
|