Skip to content

Commit

Permalink
max_capacity() added
Browse files Browse the repository at this point in the history
lib include reorder
  • Loading branch information
tower120 committed Mar 10, 2024
1 parent a87d50f commit 0cf07f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/bitset.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::mem::{ManuallyDrop, MaybeUninit};
use crate::{assume, BitSetBase, internals};
use crate::bitset_interface::{LevelMasks, LevelMasksIterExt};
use crate::config::{Config};
use crate::config::Config;
use crate::block::Block;
use crate::raw;

Expand Down Expand Up @@ -47,7 +47,13 @@ impl<Conf: Config> BitSet<Conf> {
#[inline]
pub fn new() -> Self{
Default::default()
}
}

/// Max usize, container with this `Conf` can hold.
#[inline]
pub const fn max_capacity() -> usize {
RawBitSet::<Conf>::max_capacity()
}

/// # Safety
///
Expand Down
11 changes: 6 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,21 @@ mod level;
mod bit_block;
mod bit_queue;
mod bit_utils;
pub mod config;
pub mod ops;
mod reduce;
mod bitset_interface;
mod apply;
pub mod iter;
pub mod cache;
pub mod internals;
mod compact_block;
mod raw;
mod small_bitset;
mod primitive_array;
mod bitset;

pub mod config;
pub mod ops;
pub mod iter;
pub mod cache;
pub mod internals;

pub use bitset_interface::{BitSetBase, BitSetInterface};
pub use apply::Apply;
pub use reduce::Reduce;
Expand Down
8 changes: 7 additions & 1 deletion src/small_bitset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type RawSmallBitSet<Conf> = RawBitSet<
/// SparseBitMap - `bit_block` acts as a sparse array:
/// ```text
/// 0 1 2 3 ◁═ popcnt before element
///
/// (dense_array indices)
/// bit_block 0 1 1 0 0 0 1 1 0 0 ...
/// └───┬─┬───────┬─┬─────────┘
/// ┌──┘┌┘ ┌─────┘ │
Expand Down Expand Up @@ -122,6 +122,12 @@ impl<Conf: SmallConfig> SmallBitSet<Conf> {
Default::default()
}

/// Max usize, container with this `Conf` can hold.
#[inline]
pub const fn max_capacity() -> usize {
RawSmallBitSet::<Conf>::max_capacity()
}

#[inline]
pub fn insert(&mut self, index: usize){
self.0.insert(index)
Expand Down

0 comments on commit 0cf07f3

Please sign in to comment.