posint get_value() : ignore invalid digits

This commit is contained in:
Michael Sippel 2024-09-02 00:07:57 +02:00
parent 3ec8164202
commit ff80a0cba0
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -35,8 +35,10 @@ pub trait PositionalUInt : SequenceView<Item = u64> {
let mut val = 0;
let mut r = 1;
for i in 0..self.len().unwrap_or(0) {
val += r * self.get(&i).unwrap();
r *= self.get_radix();
if let Some(digit_val) = self.get(&i) {
val += r * digit_val;
r *= self.get_radix();
}
}
val