use super::{super::family::define_integer_family, *};
use crate::{
error::NumeraResult,
number::traits::{
ConstLowerBounded, ConstNegOne, ConstUpperBounded, LowerBounded, NegOne, Negative,
NonPositive, NonZero, UpperBounded,
},
};
define_integer_family![build_variants:
NegativeIntegers,
"The family of [negative integers][super], also known as [`Nz`][super::Nz].",
common:
NegativeInteger+8, NegativeInteger+16, NegativeInteger+32, NegativeInteger+64,
NegativeInteger+128
;
depending:
Big, NegativeIntegerBig, "dashu-int-TODO" ];
impl Negative for NegativeIntegers {}
impl NonPositive for NegativeIntegers {
type InnerRepr = Self;
#[inline]
fn new_neg(value: Self::InnerRepr) -> NumeraResult<Self> {
Ok(value)
}
}
impl NonZero for NegativeIntegers {}
impl NegOne for NegativeIntegers {
#[inline]
fn new_neg_one() -> Self {
NegativeInteger8::new_neg_one().into()
}
}
impl ConstNegOne for NegativeIntegers {
const NEG_ONE: Self = NegativeIntegers::_8(NegativeInteger8::NEG_ONE);
}
impl LowerBounded for NegativeIntegers {
#[inline]
fn new_min() -> Self {
NegativeInteger128::new_min().into()
}
}
impl UpperBounded for NegativeIntegers {
#[inline]
fn new_max() -> Self {
NegativeInteger8::new_max().into()
}
}
impl ConstLowerBounded for NegativeIntegers {
const MIN: Self = NegativeIntegers::_128(NegativeInteger128::MIN);
}
impl ConstUpperBounded for NegativeIntegers {
const MAX: Self = NegativeIntegers::_8(NegativeInteger8::MAX);
}