Skip to main content

fastnum/bint/
int.rs

1mod bits;
2mod carrying;
3mod checked;
4mod cmp;
5mod convert;
6mod endian;
7mod impls;
8mod intrinsics;
9mod math;
10mod num;
11mod overflowing;
12mod saturating;
13mod strict;
14mod widening;
15mod wrapping;
16
17use bnum::BInt;
18
19use crate::bint::{consts::consts_impl, doc};
20
21/// Generic Signed integer type composed of 64-bit
22/// digits, of arbitrary fixed size which must be known at compile time.
23///
24/// Digits are stored in little endian (the least significant digit first).
25/// This integer type aims to exactly replicate the behaviours of Rust's
26/// built-in signed integer types: `u8`, `u16`, `u32`, `u64`, `u128` and
27/// `usize`.
28/// The const generic parameter `N` is the number of 64-bit digits that are
29/// stored.
30#[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
31#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
32#[cfg_attr(
33    feature = "borsh",
34    derive(borsh::BorshSerialize, borsh::BorshDeserialize, borsh::BorshSchema)
35)]
36#[repr(transparent)]
37pub struct Int<const N: usize>(pub(super) BInt<N>);
38
39consts_impl!(Int, I, BInt);