Git Product home page Git Product logo

bva's Introduction

bva

crates.io Version Rayon documentation Build Status codecov Minimum Rust 1.61 LICENSE

bva is a rust crate for manipulating and doing arithmetics on bit vectors of fixed but arbitrary size. They are meant to behave like CPU hardware registers with wrap-around on overflow.

This crate emphasizes optimizing storage by providing alternative storage options. The module fixed contains implementations using arrays of unsigned integers as storage and thus have a fixed capacity. The module dynamic contains an implementation using a dynamically allocated array of integers as storage and therefore has a dynamic capacity. The module auto contains an implementation capable of switching at runtime between a fixed or dynamic capacity implementation to try to minimize dynamic memory allocations. All of those implementations implement the BitVector trait and can be freely mixed together and used interchangeably via generic traits.

Changelog

  • 2024/07/07 - 0.3.0
    • Multiplication, division and modulo operations
    • Various helper functions
    • Much more rigorous testing reaching high code coverage.
  • 2023/07/04 - 0.2.0
    • Major rewrite using const generics
    • Iterator support
  • 2020/12/20 - 0.1.0
    • BitVector trait with fixed, dynamic and auto implementations.
    • Conversion between all the implementations
    • Basic arithmetic operations between the different implementations.
    • Reading and writing bit vector in various format.

Roadmap

  • Aiming for 100% code coverage.
  • Signed operation support.
  • Borrowing of bits and bit slice inside a bit vector.
  • Numerical algorithms such as gcd, modular exponentiation, ...
  • no-std support

Why

None of the existing crate really satisfied me and I wanted an implementation capable of minimizing dynamic memory allocations by automatically switching to fixed storage. I also wanted a crate that was capable of doing arithmetics on arbitrarily sized bit vectors, not just powers of two. Also it was great practice for my rust macro writing skills.

bva's People

Contributors

haxelion avatar

Stargazers

 avatar  avatar  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.