From 03884fdbcc8783b29f96dabb59f9f781f53012ef Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 25 Mar 2016 17:02:31 -0700 Subject: [PATCH] bigint: reapply #176 --- bigint/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bigint/src/lib.rs b/bigint/src/lib.rs index dcd8aca..5257e3a 100644 --- a/bigint/src/lib.rs +++ b/bigint/src/lib.rs @@ -2884,6 +2884,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]