Skip to main content

fastnum/bint/int/
wrapping.rs

1use crate::bint::{doc, intrinsics::ExpType, wrapping::wrapping_impl, Int, UInt};
2
3wrapping_impl!(Int, I);
4
5#[doc = doc::wrapping::impl_desc!()]
6impl<const N: usize> Int<N> {
7    #[doc = doc::wrapping::wrapping_add_unsigned!(I 256)]
8    #[must_use = doc::must_use_op!()]
9    #[inline(always)]
10    pub const fn wrapping_add_unsigned(self, rhs: UInt<N>) -> Self {
11        Self(self.0.wrapping_add_unsigned(rhs.0))
12    }
13
14    #[doc = doc::wrapping::wrapping_sub_unsigned!(I 256)]
15    #[must_use = doc::must_use_op!()]
16    #[inline(always)]
17    pub const fn wrapping_sub_unsigned(self, rhs: UInt<N>) -> Self {
18        Self(self.0.wrapping_sub_unsigned(rhs.0))
19    }
20
21    #[doc = doc::wrapping::wrapping_abs!(I 256)]
22    #[must_use = doc::must_use_op!()]
23    #[inline(always)]
24    pub const fn wrapping_abs(self) -> Self {
25        Self(self.0.wrapping_abs())
26    }
27}