Merge pull request #1032 from aarroyoc/fix-1009
Fix #1009 by providing a naive num-bigint implementation of count_ones
This commit is contained in:
@@ -117,6 +117,11 @@ impl Integer {
|
||||
pub fn gcd(&self, other: &Self) -> Self {
|
||||
Integer(num_integer::Integer::gcd(&self.0, &other.0))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn count_ones(&self) -> Option<u32> {
|
||||
Some(self.0.to_u32_digits().1.iter().map(|&d| d.count_ones()).sum())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Integer> for Integer {
|
||||
|
||||
Reference in New Issue
Block a user