From e7331b36aedf6cff5f614b0b4d91e2d81ada262f Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Thu, 22 Aug 2024 17:39:02 +0200 Subject: [PATCH] radix convert: accept radix=0 for native digit radix (2^64) --- lib-nested-core/src/editors/integer/radix.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib-nested-core/src/editors/integer/radix.rs b/lib-nested-core/src/editors/integer/radix.rs index 36213a9..685452b 100644 --- a/lib-nested-core/src/editors/integer/radix.rs +++ b/lib-nested-core/src/editors/integer/radix.rs @@ -116,9 +116,13 @@ impl RadixProjection { if val == 0 { self.dst_digits.push(0); } else { - while val > 0 { - self.dst_digits.push(val % self.dst_radix); - val /= self.dst_radix; + if self.dst_radix == 0 { + self.dst_digits.push(val); + } else { + while val > 0 { + self.dst_digits.push(val % self.dst_radix); + val /= self.dst_radix; + } } } }