diff --git a/src/bigint.rs b/src/bigint.rs index c697850..386e749 100644 --- a/src/bigint.rs +++ b/src/bigint.rs @@ -1483,8 +1483,12 @@ fn to_str_radix_reversed(u: &BigUint, radix: u32) -> Vec { // Now convert everything to ASCII digits. for r in &mut res { - const DIGITS: &'static [u8; 36] = b"0123456789abcdefghijklmnopqrstuvwxyz"; - *r = DIGITS[*r as usize]; + debug_assert!((*r as u32) < radix); + if *r < 10 { + *r += b'0'; + } else { + *r += b'a' - 10; + } } res }