Ranged Bitmap
A high-performance bitmap library.
Features
- All functions are constant
- Optimized range operations that work on multiple bits simultaneously
- No_std compatibility for embedded and bare-metal environments
Performance
This library is designed with performance as a primary goal:
- Range operations use precomputed lookup tables for optimal bit manipulation
- Bulk operations on full blocks use
memset-like operations for maximum speed - All functions are marked
#[inline(always)]for aggressive inlining - Constant functions enable compile-time optimizations
- Hardware-accelerated bit counting operations
Basic Usage
use generate_fixed_bit_map_struct;
generate_fixed_bit_map_struct!
Range Operations
The library excels at a range of operations:
use FixedBitMap;
let mut bitmap = new; // 128 bits
// Efficiently set large ranges
bitmap.set_range; // Set first block
bitmap.set_range; // Set second block
// Check range status
assert!;
// Clear ranges efficiently
bitmap.clear_range; // Clear middle portion
Performance Characteristics
| Operation | Complexity | Notes |
|---|---|---|
| Individual bit get/set/clear | O(1) | Single memory access |
| Range operations (single block) | O(1) | Bitmask operations |
| Range operations (multi-block) | O(n) | n = number of affected blocks |
| Full block operations | O(n) | memset-like optimizations |
| Bit counting | O(n) | Hardware-accelerated |
License
This project is licensed under the MIT License.