From 19f96fe62cca290823a2965f4fc203fafc6536d2 Mon Sep 17 00:00:00 2001 From: Tamas Blummer Date: Sun, 11 Feb 2018 14:19:58 +0100 Subject: [PATCH] add low_u64 to Uint256 and Uit128 types --- src/util/uint.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/uint.rs b/src/util/uint.rs index 19c90fa1..286dd139 100644 --- a/src/util/uint.rs +++ b/src/util/uint.rs @@ -38,6 +38,14 @@ macro_rules! construct_uint { 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 #[inline] pub fn bits(&self) -> usize {