add low_u64 to Uint256 and Uit128 types

This commit is contained in:
Tamas Blummer 2018-02-11 14:19:58 +01:00
parent 01e164025a
commit 19f96fe62c
1 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,14 @@ macro_rules! construct_uint {
arr[0] as u32 arr[0] as u32
} }
/// Conversion to u64
#[inline]
pub fn low_u64(&self) -> u64 {
let &$name(ref arr) = self;
arr[0] as u64
}
/// Return the least number of bits needed to represent the number /// Return the least number of bits needed to represent the number
#[inline] #[inline]
pub fn bits(&self) -> usize { pub fn bits(&self) -> usize {