Expand description
§BitArray Module
Provides flexible bit manipulation and storage abstractions for FlexFloat operations. The module defines a common interface for bit arrays with various backing implementations.
§Overview
The BitArray trait provides a unified interface for:
- Bit storage: Efficient storage of arbitrary-length bit sequences
- Type conversion: Seamless conversion between numeric types and bit representations
- Bit manipulation: Common operations like shifting, range extraction, and iteration
- Endianness handling: Little-endian byte order for consistency
§Key Features
- Multiple implementations: Currently supports boolean vector backing with room for optimization
- Type safety: Strong typing prevents common bit manipulation errors
- Conversion utilities: Built-in support for f64, BigUint, BigInt, and byte arrays
- Memory efficiency: Compact representation with configurable bit lengths
§Usage Examples
use flexfloat::bitarray::{BitArray, BoolBitArray};
// Create from various sources
let from_bits = BoolBitArray::from_bits(&[true, false, true]);
let from_bytes = BoolBitArray::from_bytes(&[0xAB], 8);
let from_f64 = BoolBitArray::from_f64(3.14159);
// Access and manipulate bits
let bit_3 = from_bits[2]; // true
let range = from_bits.get_range(0..2).unwrap();
// Convert back to other types
let bytes = from_bits.to_bytes();
let bits = from_bits.to_bits();Re-exports§
pub use boolean_list::BoolBitArray;
Modules§
- boolean_
list - Boolean List Implementation
Traits§
- BitArray
- Core trait for bit array implementations with little-endian byte ordering.
Type Aliases§
- Default
BitArray - Default BitArray implementation for general use