[][src]Crate bva

Crate for manipulating bit vectors and doing arithmetic on arbitrarily sized bit vectors.

This crate emphasizes optimizing storage by providing alternative storage options. The module fixed contains implementations using unsigned integers as storage and thus has a fixed capacity. The module dynamic contains an implementation using 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 converted into each other.

The different bit vector types represent a vector of bits where the bit at index 0 is the least significant bit and the bit at index .len() - 1 is the most significant bit. There is no notion of endianness for the bit vector themselves, endianness is only involved when reading or writing a bit vector to or from memory or storage.

Arithmetic operation can be applied to bit vectors of different length. The result will always have the length of the longest operand and the smallest operand will be zero extended for the operation. This should match the most intuitive behavior in most cases except when manipulating bit vector supposed to have a sign bit.

Modules

auto

This module contains an automatically managed bit vector type. Depending on the required capacity, it might use a fixed capacity implementation to avoid unnecessary dynamic memory allocations, or it might use a dynamic capacity implementation if the capacity of fixed implementations is exceeded.

bit
dynamic

This module contains a dynamic capacity bit vector implementation using a dynamically allocated integer array as storage.

fixed

This module contains fixed capacity bit vector implementations using a single integer as storage. Each implementations is named BV followed by a number corresponding to its max bit capacity.

Enums

Endianness

A enumeration representing the endianness of an I/O or memory operation.

Traits

BitVector

A trait representing common bit vector operations.