diff --git a/src/uint.rs b/src/uint.rs index b28583d..27b262f 100644 --- a/src/uint.rs +++ b/src/uint.rs @@ -7,6 +7,9 @@ use uint::construct_uint; +construct_uint! { + pub struct U320(5); +} construct_uint! { pub struct U256(4); } @@ -14,11 +17,17 @@ construct_uint! { pub struct U192(3); } + #[allow(dead_code)] pub const fn to_u256(n: u128) -> U256 { U256([n as u64, (n >> 64) as u64, 0, 0]) } +// #[allow(dead_code)] +// pub const fn to_u320(n: U256) -> U320 { +// U320([n as u64, (n >> 64) as u64,0,0]) +// } + #[cfg(test)] mod tests { use super::*; @@ -68,4 +77,13 @@ mod tests { assert_eq!(from, back); } } + + #[test] + fn test_u320_methods() { + let _max = U320::MAX; + let _from = U320::from(10); + let zero = U320::zero(); + let is_zero =zero.is_zero(); + assert!(is_zero); + } }