leb128-binary-0.1.2: Signed and unsigned LEB128 codec for binary library
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Binary.ZLEB128

Contents

Description

ZigZag LEB128 codec. This codec encodes the ZigZag representation of a signed number through ULEB128.

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 Signed LEB128 codec at Data.Binary.SLEB128.

Synopsis

Documentation

newtype ZLEB128 x Source #

Newtype wrapper for Binary encoding and decoding x using the ZigZag LEB128 codec. Useful in conjunction with DerivingVia.

Constructors

ZLEB128 x 

Instances

Instances details
Binary (ZLEB128 Int16) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Int32) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Int64) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Int8) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Word16) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Word32) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Word64) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Word8) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Integer) Source #

Note: Maximum allowed number of input bytes is restricted to 1024. Use putNatural if you want a greater limit.

Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Natural) Source #

Note: Maximum allowed number of input bytes is restricted to 1024. Use putNatural if you want a greater limit.

Instance details

Defined in Data.Binary.ZLEB128

Binary (ZLEB128 Int) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Methods

put :: ZLEB128 Int -> Put #

get :: Get (ZLEB128 Int) #

putList :: [ZLEB128 Int] -> Put #

Binary (ZLEB128 Word) Source # 
Instance details

Defined in Data.Binary.ZLEB128

Put

Get

getInteger Source #

Arguments

:: Int

Maximum number of bytes to consume. If the Integer number can be determined before consuming this number of bytes, it will be. If 0, parsing fails.

Each ULEB128 byte encodes at most 7 bits of data. That is, \(length(encoded) == \lceil\frac{length(data)}{7}\rceil\).

-> Get Integer 

getNatural Source #

Arguments

:: Int

Maximum number of bytes to consume. If the Integer number can be determined before consuming this number of bytes, it will be. If 0, parsing fails.

Each ULEB128 byte encodes at most 7 bits of data. That is, \(length(encoded) == \lceil\frac{length(data)}{7}\rceil\).

-> Get Natural