Skip to content

Commit

Permalink
fix length check in BddVariableSet::new
Browse files Browse the repository at this point in the history
  • Loading branch information
zao111222333 committed Dec 22, 2024
1 parent 920fa97 commit bc41250
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/_impl_bdd_variable_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl BddVariableSet {
///
/// *Panics:* `vars` must contain unique names which are allowed as variable names.
pub fn new(vars: &[&str]) -> BddVariableSet {
let num_vars = vars.len() as u16;
if num_vars >= u16::MAX - 1 {
let num_vars = vars.len();
if num_vars >= ((u16::MAX - 1) as usize) {
panic!(

Check warning on line 31 in src/_impl_bdd_variable_set.rs

View check run for this annotation

Codecov / codecov/patch

src/_impl_bdd_variable_set.rs#L31

Added line #L31 was not covered by tests
"Too many BDD variables. There can be at most {} variables.",
u16::MAX - 1
Expand Down Expand Up @@ -55,7 +55,7 @@ impl BddVariableSet {
panic!("Existing duplicated BDD variable.");

Check warning on line 55 in src/_impl_bdd_variable_set.rs

View check run for this annotation

Codecov / codecov/patch

src/_impl_bdd_variable_set.rs#L55

Added line #L55 was not covered by tests
}
BddVariableSet {
num_vars,
num_vars: num_vars as u16,
var_names,
var_index_mapping,
}
Expand Down

0 comments on commit bc41250

Please sign in to comment.