const ONE: Self;
const MIN: Self;
const MAX: Self;
+ const BITS: Self;
}
pub trait PrimUInt: PrimInt + ConvertFrom<Self::SignedType> {
const ONE: Self = 1;
const MIN: Self = 0;
const MAX: Self = !0;
+ const BITS: Self = (0 as $uint).count_zeros() as $uint;
}
impl PrimInt for $sint {
const ZERO: Self = 0;
const ONE: Self = 1;
const MIN: Self = $sint::MIN;
const MAX: Self = $sint::MAX;
+ const BITS: Self = (0 as $sint).count_zeros() as $sint;
}
impl PrimUInt for $uint {
type SignedType = $sint;
fn trunc(self) -> Self;
/// round to nearest, ties to unspecified
fn round(self) -> Self;
+ fn floor(self) -> Self;
+ fn ceil(self) -> Self;
fn copy_sign(self, sign: Self) -> Self;
}
return crate::algorithms::base::round_to_nearest_ties_to_even(Scalar, Value(self))
.0;
}
+ fn floor(self) -> Self {
+ #[cfg(feature = "std")]
+ return $float::floor(self);
+ #[cfg(not(feature = "std"))]
+ return crate::algorithms::base::floor(Scalar, Value(self)).0;
+ }
+ fn ceil(self) -> Self {
+ #[cfg(feature = "std")]
+ return $float::ceil(self);
+ #[cfg(not(feature = "std"))]
+ return crate::algorithms::base::ceil(Scalar, Value(self)).0;
+ }
fn copy_sign(self, sign: Self) -> Self {
#[cfg(feature = "std")]
return $float::copysign(self, sign);