Merge pull request #42 from tamasblummer/add_low_u64

add low_u64 to Uint256 and Uit128 types
This commit is contained in:
Andrew Poelstra 2018-02-18 14:57:37 +00:00 committed by GitHub
commit 91a786d22c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {