Inline pragmas for better LEB encoding perf
This commit is contained in:
parent
dde5a9b07d
commit
5fb3bdbeaa
3 changed files with 16 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -851,14 +851,17 @@ ascii8 (C# c0) (C# c1) (C# c2) (C# c3) (C# c4) (C# c5) (C# c6) (C# c7) = Unsafe.
|
|||
|
||||
-- | Encode a machine-sized word with LEB-128.
|
||||
wordLEB128 :: Word -> Builder 10
|
||||
{-# inline wordLEB128 #-}
|
||||
wordLEB128 (W# w) = lebCommon (W# w)
|
||||
|
||||
-- | Encode a 32-bit word with LEB-128.
|
||||
word32LEB128 :: Word32 -> Builder 5
|
||||
{-# inline word32LEB128 #-}
|
||||
word32LEB128 (W32# w) = lebCommon (W# (C.word32ToWord# w))
|
||||
|
||||
-- | Encode a 64-bit word with LEB-128.
|
||||
word64LEB128 :: Word64 -> Builder 10
|
||||
{-# inline word64LEB128 #-}
|
||||
word64LEB128 (W64# w) = lebCommon (W# w)
|
||||
|
||||
lebCommon :: Word -> Builder n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue