#[allow(deprecated)]
use crate::tokens::Has128BitSimd;
use crate::tokens::SimdToken;
#[derive(Clone, Copy, Debug)]
pub struct Wasm128Token {
_private: (),
}
impl crate::tokens::Sealed for Wasm128Token {}
impl SimdToken for Wasm128Token {
const NAME: &'static str = "WASM SIMD128";
const TARGET_FEATURES: &'static str = "simd128";
const ENABLE_TARGET_FEATURES: &'static str = "-Ctarget-feature=+simd128";
const DISABLE_TARGET_FEATURES: &'static str = "-Ctarget-feature=-simd128";
#[inline]
fn compiled_with() -> Option<bool> {
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
{
Some(true)
}
#[cfg(not(all(target_arch = "wasm32", target_feature = "simd128")))]
{
None
}
}
#[inline]
fn summon() -> Option<Self> {
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
{
Some(Self::from_context())
}
#[cfg(not(all(target_arch = "wasm32", target_feature = "simd128")))]
{
None
}
}
}
impl Wasm128Token {
#[inline]
#[target_feature(enable = "simd128")]
pub fn from_context() -> Self {
Self { _private: () }
}
#[deprecated(
since = "0.9.29",
note = "Renamed to from_context() — the constructor is checked against the caller's target-feature context"
)]
#[inline]
#[target_feature(enable = "simd128")]
pub fn forge_token_dangerously() -> Self {
Self::from_context()
}
}
#[derive(Clone, Copy, Debug)]
pub struct Wasm128RelaxedToken {
_private: (),
}
impl crate::tokens::Sealed for Wasm128RelaxedToken {}
impl SimdToken for Wasm128RelaxedToken {
const NAME: &'static str = "WASM Relaxed SIMD";
const TARGET_FEATURES: &'static str = "simd128,relaxed-simd";
const ENABLE_TARGET_FEATURES: &'static str = "-Ctarget-feature=+simd128,+relaxed-simd";
const DISABLE_TARGET_FEATURES: &'static str = "-Ctarget-feature=-simd128,-relaxed-simd";
#[inline]
fn compiled_with() -> Option<bool> {
#[cfg(all(
target_arch = "wasm32",
target_feature = "simd128",
target_feature = "relaxed-simd"
))]
{
Some(true)
}
#[cfg(not(all(
target_arch = "wasm32",
target_feature = "simd128",
target_feature = "relaxed-simd"
)))]
{
None
}
}
#[inline]
fn summon() -> Option<Self> {
#[cfg(all(
target_arch = "wasm32",
target_feature = "simd128",
target_feature = "relaxed-simd"
))]
{
Some(Self::from_context())
}
#[cfg(not(all(
target_arch = "wasm32",
target_feature = "simd128",
target_feature = "relaxed-simd"
)))]
{
None
}
}
}
impl Wasm128RelaxedToken {
#[inline]
#[target_feature(enable = "simd128,relaxed-simd")]
pub fn from_context() -> Self {
Self { _private: () }
}
#[deprecated(
since = "0.9.29",
note = "Renamed to from_context() — the constructor is checked against the caller's target-feature context"
)]
#[inline]
#[target_feature(enable = "simd128,relaxed-simd")]
pub fn forge_token_dangerously() -> Self {
Self::from_context()
}
}
impl Wasm128RelaxedToken {
#[inline(always)]
pub fn wasm128(self) -> Wasm128Token {
Wasm128Token::from_context()
}
}
impl Wasm128Token {
#[doc(hidden)]
pub const __ARCHMAGE_TIER_TAG: u32 = 0x1E0DF26B;
#[doc(hidden)]
pub const __ARCHMAGE_ASSERT_TIER_1E0DF26B: () =
[()][!(Self::__ARCHMAGE_TIER_TAG == 0x1E0DF26B) as usize];
}
impl Wasm128RelaxedToken {
#[doc(hidden)]
pub const __ARCHMAGE_TIER_TAG: u32 = 0x821D5452;
#[doc(hidden)]
pub const __ARCHMAGE_ASSERT_TIER_821D5452: () =
[()][!(Self::__ARCHMAGE_TIER_TAG == 0x821D5452) as usize];
}
#[allow(deprecated)]
impl Has128BitSimd for Wasm128Token {}
#[allow(deprecated)]
impl Has128BitSimd for Wasm128RelaxedToken {}