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