From df34563eda53c215179493fe1a1046caa3cc67f1 Mon Sep 17 00:00:00 2001 From: Murarth Date: Sat, 5 Mar 2016 13:46:22 -0700 Subject: [PATCH] Expose `BigUint::bits` through `BigInt` --- src/bigint.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bigint.rs b/src/bigint.rs index 545b943..ede5e78 100644 --- a/src/bigint.rs +++ b/src/bigint.rs @@ -2750,6 +2750,11 @@ impl BigInt { str::from_utf8(buf).ok().and_then(|s| BigInt::from_str_radix(s, radix).ok()) } + /// Determines the fewest bits necessary to express the `BigInt`, + /// not including the sign. + pub fn bits(&self) -> usize { + self.data.bits() + } /// Converts this `BigInt` into a `BigUint`, if it's not negative. #[inline]