Inline pragmas for better LEB encoding perf

This commit is contained in:
Andrew Martin 2022-04-11 15:49:02 -04:00
parent dde5a9b07d
commit 5fb3bdbeaa
3 changed files with 16 additions and 0 deletions

View file

@ -1162,14 +1162,17 @@ int64LEB128 = word64LEB128 . toZigzag64
-- | Encode a machine-sized word with LEB-128.
wordLEB128 :: Word -> Builder
{-# inline wordLEB128 #-}
wordLEB128 w = fromBounded Nat.constant (Bounded.wordLEB128 w)
-- | Encode a 32-bit word with LEB-128.
word32LEB128 :: Word32 -> Builder
{-# inline word32LEB128 #-}
word32LEB128 w = fromBounded Nat.constant (Bounded.word32LEB128 w)
-- | Encode a 64-bit word with LEB-128.
word64LEB128 :: Word64 -> Builder
{-# inline word64LEB128 #-}
word64LEB128 w = fromBounded Nat.constant (Bounded.word64LEB128 w)
-- | Encode a signed arbitrary-precision integer as decimal.