Skip to content

Integer encoding for primitive integer types: Supports varint/varint+zigzag and fixed-length integer encoding and decoding, and provides Write/Read types for easily writing/reading integers.

License

Notifications You must be signed in to change notification settings

mesalock-linux/integer-encoding-rs-sgx

 
 

Repository files navigation

integer-encoding-rs

crates.io Build Status

full documentation

This crate provides encoding and decoding of integers to and from bytestring representations.

The format is described here: Google's protobuf integer encoding technique.

FixedInt

FixedInt casts integers to bytes by either copying the underlying memory or performing a transmutation. The encoded values use machine endianness (little-endian on x86).

VarInt

VarInt encodes integers in blocks of 7 bits; the MSB is set for every byte but the last, in which it is cleared.

Signed values are first converted to an unsigned representation using zigzag encoding (also described on the page linked above), and then encoded as every other unsigned number.

About

Integer encoding for primitive integer types: Supports varint/varint+zigzag and fixed-length integer encoding and decoding, and provides Write/Read types for easily writing/reading integers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 72.5%
  • Rust 19.0%
  • Makefile 4.3%
  • C++ 4.2%