We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e94bdaf commit bcf065aCopy full SHA for bcf065a
1 file changed
src/lib.rs
@@ -1221,6 +1221,19 @@ impl BigDecimalRef<'_> {
1221
count_decimal_digits_uint(self.digits)
1222
}
1223
1224
+ /// Return the number of trailing zeros in the referenced integer
1225
+ #[allow(dead_code)]
1226
+ fn count_trailing_zeroes(&self) -> usize {
1227
+ if self.digits.is_zero() || self.digits.is_odd() {
1228
+ return 0;
1229
+ }
1230
+
1231
+ let digit_pairs = self.digits.to_radix_le(100);
1232
+ let loc = digit_pairs.iter().position(|&d| d != 0).unwrap_or(0);
1233
1234
+ 2 * loc + usize::from(digit_pairs[loc] % 10 == 0)
1235
1236
1237
/// Split into components
1238
pub(crate) fn as_parts(&self) -> (Sign, i64, &BigUint) {
1239
(self.sign, self.scale, self.digits)
0 commit comments