1 // Adapted from https://github.com/Alexhuszagh/rust-lexical. 2 3 //! Big integer type definition. 4 5 use super::math::*; 6 use crate::lib::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 { default() -> Self16 fn default() -> Self { 17 Bigint { 18 data: Vec::with_capacity(20), 19 } 20 } 21 } 22 23 impl Math for Bigint { 24 #[inline] data(&self) -> &Vec<Limb>25 fn data(&self) -> &Vec<Limb> { 26 &self.data 27 } 28 29 #[inline] data_mut(&mut self) -> &mut Vec<Limb>30 fn data_mut(&mut self) -> &mut Vec<Limb> { 31 &mut self.data 32 } 33 } 34