@@ -120,22 +120,22 @@ i2w v = zero + fromIntegral v
120120
121121countDigits :: (Integral a) => a -> Int
122122{-# INLINE countDigits #-}
123−countDigits v0 = go 1 (fromIntegral v0 :: Word64)
124− where go !k v
125− | v < 10 = k
126− | v < 100 = k + 1
127− | v < 1000 = k + 2
123+countDigits v0 = go (fromIntegral v0 :: Word64)
124+ where go v
125+ | v < 10 = 1
126+ | v < 100 = 2
127+ | v < 1000 = 3
128128 | v < 1000000000000 =
129− k + if v < 100000000
130− then if v < 1000000
131− then if v < 10000
132− then 3
133− else 4 + fin v 100000
134− else 6 + fin v 10000000
135− else if v < 10000000000
136− then 8 + fin v 1000000000
137− else 10 + fin v 100000000000
138− | otherwise = go (k + 12) (v `quot` 1000000000000)
129+ if v < 100000000
130+ then if v < 1000000
131+ then if v < 10000
132+ then 4
133+ else 5 + fin v 100000
134+ else 7 + fin v 10000000
135+ else if v < 10000000000
136+ then 9 + fin v 1000000000
137+ else 11 + fin v 100000000000
138+ | otherwise = 12 + go (v `quot` 1000000000000)
139139 fin v n = if v >= n then 1 else 0
140140
141141hexadecimal :: Integral a => a -> Builder