Skip to content

Commit

Permalink
Fix unnecessary calls to padding
Browse files Browse the repository at this point in the history
  • Loading branch information
kozross committed Dec 11, 2023
1 parent df7b35a commit f3cb384
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Naive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ toByteString requestedLength requestedByteOrder i = case signum i of
_ -> goBELimit (word64BE digitGroup <> acc) newRemaining
goLENoLimit :: Builder -> Integer -> Builder
goLENoLimit acc remaining
| remaining == 0 = padLE acc
| remaining == 0 = acc
| otherwise =
let newRemaining = remaining `unsafeShiftR` 64
digitGroup = fromInteger remaining
Expand All @@ -149,7 +149,7 @@ toByteString requestedLength requestedByteOrder i = case signum i of
_ -> goLENoLimit (acc <> storable digitGroup) newRemaining
goBENoLimit :: Builder -> Integer -> Builder
goBENoLimit acc remaining
| remaining == 0 = padBE acc
| remaining == 0 = acc
| otherwise =
let newRemaining = remaining `unsafeShiftR` 64
digitGroup = fromInteger remaining
Expand Down

0 comments on commit f3cb384

Please sign in to comment.