Struct biodivine_lib_bdd::BddPointer
source · pub struct BddPointer(/* private fields */);
Expand description
A type-safe index into the Bdd
node array representation.
BDD pointers are an internal type-safe wrapper around indices into BDD arrays.
Outside this crate, no one should know or care about their existence. Since
we can’t reasonably expect a BDD to be larger than 2^32
right now, the pointer is
represented as u32
instead of usize
, because usize
can be 64-bits and pointers
represent most of the memory consumed by our BDDs.
Implementations§
source§impl BddPointer
impl BddPointer
sourcepub fn zero() -> BddPointer
pub fn zero() -> BddPointer
Make a new pointer to the 0
terminal node.
sourcepub fn one() -> BddPointer
pub fn one() -> BddPointer
Make a new pointer to the 1
terminal node.
sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if the pointer corresponds to the 0
or 1
terminal.
sourcepub fn from_index(index: usize) -> BddPointer
pub fn from_index(index: usize) -> BddPointer
Create a pointer from an usize index.
sourcepub fn from_bool(value: bool) -> BddPointer
pub fn from_bool(value: bool) -> BddPointer
Convert a bool
value to valid terminal BDD pointer.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If this pointer is a terminal, convert it to bool
, otherwise return None
.
sourcepub fn flip_if_terminal(&mut self)
pub fn flip_if_terminal(&mut self)
If this pointer corresponds to a terminal node, flip it (switching 1
to 0
and
vice versa).
sourcepub fn to_le_bytes(self) -> [u8; 4]
pub fn to_le_bytes(self) -> [u8; 4]
Convert to little endian bytes
sourcepub fn from_le_bytes(bytes: [u8; 4]) -> BddPointer
pub fn from_le_bytes(bytes: [u8; 4]) -> BddPointer
Read from little endian byte representation
Trait Implementations§
source§impl Clone for BddPointer
impl Clone for BddPointer
source§fn clone(&self) -> BddPointer
fn clone(&self) -> BddPointer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BddPointer
impl Debug for BddPointer
source§impl Display for BddPointer
impl Display for BddPointer
For display purposes, pointer is just a number.
source§impl Hash for BddPointer
impl Hash for BddPointer
source§impl Ord for BddPointer
impl Ord for BddPointer
source§fn cmp(&self, other: &BddPointer) -> Ordering
fn cmp(&self, other: &BddPointer) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for BddPointer
impl PartialEq for BddPointer
source§fn eq(&self, other: &BddPointer) -> bool
fn eq(&self, other: &BddPointer) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for BddPointer
impl PartialOrd for BddPointer
source§fn partial_cmp(&self, other: &BddPointer) -> Option<Ordering>
fn partial_cmp(&self, other: &BddPointer) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more