1 | // Adapted from https://github.com/Alexhuszagh/rust-lexical. |
2 | |
3 | //! Big integer type definition. |
4 | |
5 | use super::math::*; |
6 | use alloc::vec::Vec; |
7 | |
8 | /// Storage for a big integer type. |
9 | #[derive(Clone, PartialEq, Eq)] |
10 | pub(crate) struct Bigint { |
11 | /// Internal storage for the Bigint, in little-endian order. |
12 | pub(crate) data: Vec<Limb>, |
13 | } |
14 | |
15 | impl Default for Bigint { |
16 | fn default() -> Self { |
17 | Bigint { |
18 | data: Vec::with_capacity(20), |
19 | } |
20 | } |
21 | } |
22 | |
23 | impl Math for Bigint { |
24 | #[inline ] |
25 | fn data(&self) -> &Vec<Limb> { |
26 | &self.data |
27 | } |
28 | |
29 | #[inline ] |
30 | fn data_mut(&mut self) -> &mut Vec<Limb> { |
31 | &mut self.data |
32 | } |
33 | } |
34 | |