Skip to content

Haskell libraries for variable-length integer encoding

License

Notifications You must be signed in to change notification settings

concert/hs-varword

Repository files navigation

Variable length integer encoding

Hackage pipeline status

  • attoparsec coverage attoparsec
  • bytestring-builder coverage bytestring-builder

This repository consists of two Haskell libraries:

Motivation

Encoding values of multi-byte types (such as Word32) can be quite wasteful. Often there are many leading zeros which inflate the size of the encoded data. The encodings in this library drop leading empty bytes from the encoding, which produces more compact data.

Broadly speaking, the value to be encoding is divided into 7-bit chunks. The most significant bit of each byte is then used when decoding as a flag to signal whether more data is still to be read for the value being parsed.

This library presents big-endian (most significant byte first) and little-endian (least significant bytes first) variants of the encoding scheme. Further, we include a dense version, used in parts of git, that packs the encoded data a little tighter still.

About

Haskell libraries for variable-length integer encoding

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •