Skip to content

Commit

Permalink
add is_tru is fals methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Sep 16, 2024
1 parent d1ba3ef commit 42e16cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "baa"
version = "0.9.3"
version = "0.9.4"
edition = "2021"
authors = ["Kevin Laeufer <[email protected]>"]
description = "BitVector and Array Arithmetic"
Expand Down
8 changes: 8 additions & 0 deletions src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ pub trait BitVecOps {
}
}

fn is_tru(&self) -> bool {
self.width() == 1 && self.words()[0] == 1
}

fn is_fals(&self) -> bool {
self.width() == 1 && self.words()[0] == 0
}

fn is_zero(&self) -> bool {
self.words().iter().all(|w| *w == 0)
}
Expand Down

0 comments on commit 42e16cd

Please sign in to comment.