+ ops::ShlAssign
+ ops::ShrAssign
{
+ const ZERO: Self;
+ const ONE: Self;
+ const MIN: Self;
+ const MAX: Self;
}
pub trait PrimUInt: PrimInt + ConvertFrom<Self::SignedType> {
($uint:ident, $sint:ident) => {
impl PrimBase for $uint {}
impl PrimBase for $sint {}
- impl PrimInt for $uint {}
- impl PrimInt for $sint {}
+ impl PrimInt for $uint {
+ const ZERO: Self = 0;
+ const ONE: Self = 1;
+ const MIN: Self = 0;
+ const MAX: Self = !0;
+ }
+ impl PrimInt for $sint {
+ const ZERO: Self = 0;
+ const ONE: Self = 1;
+ const MIN: Self = $sint::MIN;
+ const MAX: Self = $sint::MAX;
+ }
impl PrimUInt for $uint {
type SignedType = $sint;
}
}
fn is_finite(self) -> bool;
fn trunc(self) -> Self;
+ fn copy_sign(self, sign: Self) -> Self;
}
macro_rules! impl_float {
#[cfg(not(feature = "std"))]
return crate::algorithms::base::trunc(Scalar, Value(self)).0;
}
+ fn copy_sign(self, sign: Self) -> Self {
+ #[cfg(feature = "std")]
+ return $float::copysign(self);
+ #[cfg(not(feature = "std"))]
+ return crate::algorithms::base::copy_sign(Scalar, Value(self), Value(sign)).0;
+ }
}
};
}