radix convert: accept radix=0 for native digit radix (2^64)

This commit is contained in:
Michael Sippel 2024-08-22 17:39:02 +02:00
parent 0bcfd7a65a
commit e7331b36ae
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -115,6 +115,9 @@ impl RadixProjection {
let mut val = src.get_value(); let mut val = src.get_value();
if val == 0 { if val == 0 {
self.dst_digits.push(0); self.dst_digits.push(0);
} else {
if self.dst_radix == 0 {
self.dst_digits.push(val);
} else { } else {
while val > 0 { while val > 0 {
self.dst_digits.push(val % self.dst_radix); self.dst_digits.push(val % self.dst_radix);
@ -122,6 +125,7 @@ impl RadixProjection {
} }
} }
} }
}
let new_len = self.dst_digits.len(); let new_len = self.dst_digits.len();
for i in 0 .. usize::max(old_len, new_len) { for i in 0 .. usize::max(old_len, new_len) {