use super::Select;
use core::{
fmt::Debug,
ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Neg, Not},
};
mod i32;
mod i64;
#[allow(clippy::len_without_is_empty)]
pub trait SimdMask<const N: usize>
where
Self: Send + Sync + Clone + Copy + Default,
Self: PartialEq + PartialOrd,
Self: Debug,
Self: From<[bool; N]> + Into<[bool; N]>,
Self: Select<Self>,
Self: BitAnd<Output = Self> + BitAndAssign + BitAnd<bool, Output = Self> + BitAndAssign<bool>,
Self: BitOr<Output = Self> + BitOrAssign + BitOr<bool, Output = Self> + BitOrAssign<bool>,
Self: BitXor<Output = Self> + BitXorAssign + BitXor<bool, Output = Self> + BitXorAssign<bool>,
Self: Not<Output = Self>,
{
const N: usize = N;
#[must_use]
#[inline]
fn len(&self) -> usize {
N
}
#[must_use]
fn splat(value: bool) -> Self;
#[must_use]
fn from_array(array: [bool; N]) -> Self;
#[must_use]
fn to_array(self) -> [bool; N];
#[must_use]
#[inline]
fn flag(lane: usize, value: bool) -> Self {
let mut array = [!value; N];
array[lane] = value;
Self::from_array(array)
}
#[must_use]
fn all(self) -> bool;
#[must_use]
fn any(self) -> bool;
fn set(&mut self, lane: usize, value: bool);
#[must_use]
fn test(&self, lane: usize) -> bool;
#[must_use]
#[inline]
fn select<S: Select<Self>>(self, true_values: S, false_values: S) -> S {
Select::select(self, true_values, false_values)
}
#[must_use]
#[inline]
fn negate<S: Select<Self> + Neg<Output = S> + Copy>(self, values: S) -> S {
self.select(-values, values)
}
}