From 37d2fda49bdaf3663702738c4610cba7e3c058fb Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 16 Sep 2017 14:19:18 -0700 Subject: [PATCH] Pick up 4-characters-at-a-time fix from libcore https://github.com/rust-lang/rust/commit/b0e55a83a82bae26851f442859acace2b94f5028 --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5798c4e..c569fdd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,8 +65,9 @@ macro_rules! impl_Integer { let lut_ptr = DEC_DIGITS_LUT.as_ptr(); unsafe { - // eagerly decode 4 characters at a time - if <$t>::max_value() as u64 >= 10000 { + // need at least 16 bits for the 4-characters-at-a-time to work. + if mem::size_of::<$t>() >= 2 { + // eagerly decode 4 characters at a time while n >= 10000 { let rem = (n % 10000) as isize; n /= 10000;