use super::{private, CastFrom};
pub trait NumericElement:
private::Sealed
+ Copy
+ Default
+ Send
+ Sync
+ 'static
+ PartialOrd
+ PartialEq
+ core::fmt::Debug
+ core::ops::Add<Output = Self>
+ core::ops::AddAssign
+ core::ops::Sub<Output = Self>
+ core::ops::SubAssign
+ core::ops::Mul<Output = Self>
+ core::ops::MulAssign
+ core::ops::Div<Output = Self>
+ CastFrom<i32>
{
const ZERO: Self;
const ONE: Self;
const NAN: Self;
const INFINITY: Self;
const BYTE_WIDTH: usize;
const ALL_ONES: Self;
const SIGN_MASK: Self;
fn abs(self) -> Self;
fn scalar_fmadd(self, b: Self, c: Self) -> Self;
fn sqrt(self) -> Self;
fn is_finite(self) -> bool;
fn is_nan(self) -> bool;
fn to_f64(self) -> f64;
fn bitand(self, rhs: Self) -> Self;
fn bitor(self, rhs: Self) -> Self;
fn bitxor(self, rhs: Self) -> Self;
fn count_ones(self) -> u32;
#[inline(always)]
fn min_scalar(self, other: Self) -> Self
where
Self: PartialOrd,
{
if self <= other {
self
} else {
other
}
}
#[inline(always)]
fn max_scalar(self, other: Self) -> Self
where
Self: PartialOrd,
{
if self >= other {
self
} else {
other
}
}
const MIN_VALUE: Self;
const MAX_VALUE: Self;
#[inline(always)]
fn saturating_add(self, rhs: Self) -> Self {
self + rhs
}
#[inline(always)]
fn saturating_mul(self, rhs: Self) -> Self {
self * rhs
}
#[inline(always)]
fn checked_add(self, rhs: Self) -> Option<Self> {
Some(self + rhs)
}
#[inline(always)]
fn checked_mul(self, rhs: Self) -> Option<Self> {
Some(self * rhs)
}
}