Fix by providing a naive num-bigint implementation of count_ones
@@ -117,6 +117,10 @@ pub fn gcd_ref(&self, other: &Self) -> Self {
pub fn gcd(&self, other: &Self) -> Self {
Integer(num_integer::Integer::gcd(&self.0, &other.0))
}
+
+ 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 {
