Giter VIP home page Giter VIP logo

icodein / integer-encoding-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dermesser/integer-encoding-rs

0.0 1.0 0.0 692 KB

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

License: Other

Rust 98.92% Shell 1.08%

integer-encoding-rs's Introduction

integer-encoding-rs

crates.io Actions CI

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.

Please feel free to use cargo bench to determine the rate at which your machine can encode and decode varints and fixedints. Note that one iteration comprises each eight rounds of encoding (or decoding) a signed and an unsigned integer each -- divide the resulting benchmark time by 16 in order to have a rough estimate of time per operation. The integers are very large, so the results represent the worst case.

Crate

If you use Tokio v0.2 and you use the asynchronous types in this crate (feature tokio_async), you may be interested in the v2.0 branch. It is still maintained with the occasional fix for edge cases and depends on Tokio v0.2.

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.

integer-encoding-rs's People

Contributors

dermesser avatar allengeorge avatar devashishdxt avatar jamesbornholt avatar yihuang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.