pub struct LogosI64Set { /* private fields */ }Expand description
Open-addressing i64 SET — the keys-only sibling of LogosI64Map, emitted
for a Map of Int to Int the alias analysis proves is used ONLY as a set
(insert + contains; the value is never read — two_sum’s seen). ONE flat
Vec<i64> with linear probing and a 0 empty-slot sentinel (the real key
0 tracked separately for full key-space correctness). With no value array
it has HALF the store traffic and footprint of the map — 8 bytes/slot,
smaller than C’s struct Entry { long key; int occupied; }.
The sentinel is 0, not i64::MIN, on purpose: vec![0; slots] is the bit
pattern Rust’s IsZero specialization lowers to alloc_zeroed (calloc), so
the table comes from the OS lazily-zeroed — no eager 1 GiB memset/page-fault
storm up front (the kernel-time gap that made two_sum lose to C’s calloc).
Implementations§
Source§impl LogosI64Set
impl LogosI64Set
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
Sourcepub fn insert(&mut self, key: i64, _value: i64)
pub fn insert(&mut self, key: i64, _value: i64)
Insert a key. The _value parameter mirrors LogosI64Map::insert’s
call shape so codegen needs no special-casing at the insert site — by the
set-usage proof the value is never read.
pub fn contains_key(&self, key: &i64) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for LogosI64Set
impl Clone for LogosI64Set
Source§fn clone(&self) -> LogosI64Set
fn clone(&self) -> LogosI64Set
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more