diff --git a/src/value.rs b/src/value.rs index 97eab83..352690d 100644 --- a/src/value.rs +++ b/src/value.rs @@ -95,6 +95,8 @@ impl PartialEq for ValueOwned { } } +impl Eq for ValueOwned {} + impl std::ops::Add<&V> for &ValueOwned { type Output = ValueOwned; @@ -295,6 +297,7 @@ pub trait BitVecValue { /// Returns the value as a 64-bit unsigned integer iff the width is 64-bit or less. fn to_u64(&self) -> Option { + // TODO: allow conversion of bit-vectors over 64 bits if the value can fit into 64 bits if self.width() <= 64 { if self.width() == 0 { Some(0) @@ -310,6 +313,7 @@ pub trait BitVecValue { /// Returns the value as a 64-bit signed integer iff the width is 64-bit or less. fn to_i64(&self) -> Option { + // TODO: allow conversion of bit-vectors over 64 bits if the value can fit into 64 bits if self.width() <= 64 { if self.width() == 0 { Some(0) @@ -327,6 +331,10 @@ pub trait BitVecValue { } } + fn is_zero(&self) -> bool { + self.words().iter().all(|w| *w == 0) + } + declare_arith_bin_fn!(add); declare_arith_bin_fn!(sub); declare_arith_bin_fn!(shift_left);