pub struct LogosBits { /* private fields */ }Expand description
A Seq of Bool held one bit per item: the representation a local sequence of truth values takes when every use
of it is an item read, an item store, a push or its length. A table of n flags takes n / 8 bytes where a
Vec<bool> takes n, so a sieve over 10^8 numbers fits in the cache it used to stream past.
Items are counted from 1 as in every sequence, through crate::resolve_logos_index: an index counted from the
back reaches the same item, and one that names no item fails with the sentence every tier reports. The unchecked
accessors take a 0-based offset the caller has proven below LogosBits::len.
Implementations§
Source§impl LogosBits
impl LogosBits
pub fn new() -> Self
Sourcepub fn with_capacity(items: usize) -> Self
pub fn with_capacity(items: usize) -> Self
An empty sequence with room for items items before it grows.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn push(&mut self, value: bool)
Sourcepub fn item(&self, index: i64) -> bool
pub fn item(&self, index: i64) -> bool
The item index names (counted from 1, or from the back when negative).
Sourcepub unsafe fn get_unchecked(&self, offset: usize) -> bool
pub unsafe fn get_unchecked(&self, offset: usize) -> bool
Sourcepub unsafe fn set_unchecked(&mut self, offset: usize, value: bool)
pub unsafe fn set_unchecked(&mut self, offset: usize, value: bool)
Sourcepub unsafe fn set_true_unchecked(&mut self, offset: usize)
pub unsafe fn set_true_unchecked(&mut self, offset: usize)
Sourcepub unsafe fn fill_stride_unchecked(
&mut self,
first: usize,
count: usize,
step: usize,
value: bool,
)
pub unsafe fn fill_stride_unchecked( &mut self, first: usize, count: usize, step: usize, value: bool, )
Store value at the count offsets first, first + step, first + 2 * step, ….
A step of a word or more puts each offset in a word of its own, and a handful of offsets cost no more one at a
time; both store in place. Otherwise Self::fill_stride_words writes each word the progression crosses once,
out of line, so a loop that fills now and then keeps none of the walk’s state in its own registers.
§Safety
step is at least 1 and, when count is not 0, first + (count - 1) * step is below LogosBits::len.
Sourcepub unsafe fn fill_stride_through_unchecked(
&mut self,
first: usize,
through: usize,
step: usize,
value: bool,
) -> usize
pub unsafe fn fill_stride_through_unchecked( &mut self, first: usize, through: usize, step: usize, value: bool, ) -> usize
Store value at first, first + step, … up to through, and return how many steps past first that took:
a loop’s stores from its counter’s value on entry to its bound, the bound given as the offset it would store at.
Out of line, so the loop that calls it keeps no arithmetic of the progression in its own registers: what it
computes from its counter is the counter.
§Safety
step is at least 1, first <= through, and first + (through - first) / step * step is below
LogosBits::len.
Trait Implementations§
impl Eq for LogosBits
Auto Trait Implementations§
impl Freeze for LogosBits
impl RefUnwindSafe for LogosBits
impl Send for LogosBits
impl Sync for LogosBits
impl Unpin for LogosBits
impl UnsafeUnpin for LogosBits
impl UnwindSafe for LogosBits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.