Skip to content

Commit

Permalink
Remove a dead branch in integerDec
Browse files Browse the repository at this point in the history
If the absolute value of the input is small enough to enter this
branch, then it fits in an Int and takes the very first branch instead.
  • Loading branch information
clyring committed Dec 31, 2024
1 parent 5f799b6 commit c9b3101
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Data/ByteString/Builder/ASCII.hs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@ integerDec i
| otherwise = go i
where
go :: Integer -> Builder
go n | n < maxPow10 = intDec (fromInteger n)
| otherwise =
case putH (splitf (maxPow10 * maxPow10) n) of
x:|xs -> intDec x `mappend` P.primMapListBounded intDecPadded xs
go n = case putH (splitf (maxPow10 * maxPow10) n) of
x:|xs -> intDec x `mappend` P.primMapListBounded intDecPadded xs

splitf :: Integer -> Integer -> NonEmpty Integer
splitf pow10 n0
Expand Down

0 comments on commit c9b3101

Please sign in to comment.