Skip to content

Commit 7eb666f

Browse files
committed
Auto merge of #176 - murarth:bigint-bits, r=cuviper
Expose `BigUint::bits` through `BigInt`
2 parents 9b0d4c9 + df34563 commit 7eb666f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/bigint.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,11 @@ impl BigInt {
27502750
str::from_utf8(buf).ok().and_then(|s| BigInt::from_str_radix(s, radix).ok())
27512751
}
27522752

2753+
/// Determines the fewest bits necessary to express the `BigInt`,
2754+
/// not including the sign.
2755+
pub fn bits(&self) -> usize {
2756+
self.data.bits()
2757+
}
27532758

27542759
/// Converts this `BigInt` into a `BigUint`, if it's not negative.
27552760
#[inline]

0 commit comments

Comments
 (0)