Skip to content

Commit

Permalink
s/Decode/Encode
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyl20 committed Feb 6, 2024
1 parent 07d742b commit 97acb07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Data/ByteString/Internal/Pure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ reverseBytesInplace !p1 !p2
reverseBytesInplace (plusPtr p1 1) (plusPtr p2 (-1))
| otherwise = pure ()

-- | Decode signed number as decimal
-- | Encode signed number as decimal
encodeSignedDec :: (Eq a, Num a, Integral a) => a -> Ptr Word8 -> IO (Ptr Word8)
{-# INLINABLE encodeSignedDec #-} -- for specialization
encodeSignedDec !x !buf
Expand All @@ -271,12 +271,12 @@ encodeSignedDec !x !buf
_ -> encodeUnsignedDec' q (plusPtr buf 1) (plusPtr buf 2)


-- | Decode positive number as decimal
-- | Encode positive number as decimal
encodeUnsignedDec :: (Eq a, Num a, Integral a) => a -> Ptr Word8 -> IO (Ptr Word8)
{-# INLINABLE encodeUnsignedDec #-} -- for specialization
encodeUnsignedDec !v !next_ptr = encodeUnsignedDec' v next_ptr next_ptr

-- | Decode positive number as little-endian decimal, then reverse it.
-- | Encode positive number as little-endian decimal, then reverse it.
--
-- Take two pointers (orig_ptr, next_ptr) to support already encoded digits
-- (e.g. used by encodeSignedDec to avoid overflows)
Expand Down Expand Up @@ -309,12 +309,12 @@ encodeUnsignedDecPadded !max_width !v !buf = assert (max_width > 0) $ do



-- | Decode positive number as hexadecimal
-- | Encode positive number as hexadecimal
encodeUnsignedHex :: (Eq a, Num a, Integral a, Bits a) => a -> Ptr Word8 -> IO (Ptr Word8)
{-# INLINABLE encodeUnsignedHex #-} -- for specialization
encodeUnsignedHex !v !next_ptr = encodeUnsignedHex' v next_ptr next_ptr

-- | Decode positive number as little-endian hexdecimal, then reverse it.
-- | Encode positive number as little-endian hexdecimal, then reverse it.
--
-- Take two pointers (orig_ptr, next_ptr) to support already encoded digits
encodeUnsignedHex' :: (Eq a, Num a, Integral a, Bits a) => a -> Ptr Word8 -> Ptr Word8 -> IO (Ptr Word8)
Expand Down

0 comments on commit 97acb07

Please sign in to comment.