Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Signed LEB128 codec. This codec encodes the two's complement of a signed number as described here.
Any getXXX decoder can decode bytes generated using any of the putXXX encoders, provided the encoded number fits in the target type.
WARNING: This is not compatible with the Unsigned LEB128 codec at Data.Binary.ULEB128 nor with the ZigZag LEB128 codec at Data.Binary.ZLEB128.
Synopsis
- newtype SLEB128 x = SLEB128 x
- putInteger :: Integer -> Put
- putInt64 :: Int64 -> Put
- putInt32 :: Int32 -> Put
- putInt16 :: Int16 -> Put
- putInt8 :: Int8 -> Put
- putInt :: Int -> Put
- putNatural :: Natural -> Put
- putWord64 :: Word64 -> Put
- putWord32 :: Word32 -> Put
- putWord16 :: Word16 -> Put
- putWord8 :: Word8 -> Put
- putWord :: Word -> Put
- getInteger :: Int -> Get Integer
- getInt64 :: Get Int64
- getInt32 :: Get Int32
- getInt16 :: Get Int16
- getInt8 :: Get Int8
- getInt :: Get Int
- getNatural :: Int -> Get Natural
- getWord64 :: Get Word64
- getWord32 :: Get Word32
- getWord16 :: Get Word16
- getWord8 :: Get Word8
- getWord :: Get Word
Documentation
Newtype wrapper for Binary
encoding and decoding x
using the
Signed LEB128 codec. Useful in conjunction with DerivingVia
.
SLEB128 x |
Instances
Binary (SLEB128 Int16) Source # | |
Binary (SLEB128 Int32) Source # | |
Binary (SLEB128 Int64) Source # | |
Binary (SLEB128 Int8) Source # | |
Binary (SLEB128 Word16) Source # | |
Binary (SLEB128 Word32) Source # | |
Binary (SLEB128 Word64) Source # | |
Binary (SLEB128 Word8) Source # | |
Binary (SLEB128 Integer) Source # | Note: Maximum allowed number of input bytes is restricted to 1000.
Use |
Binary (SLEB128 Natural) Source # | Note: Maximum allowed number of input bytes is restricted to 1000.
Use |
Binary (SLEB128 Int) Source # | |
Binary (SLEB128 Word) Source # | |
Put
putInteger :: Integer -> Put Source #
putNatural :: Natural -> Put Source #