Skip to content

Commit 732278c

Browse files
committed
Cleanup and speedup BDD handling
1 parent 1a8bb31 commit 732278c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/bdd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn level_complexity(table: &[u64], level: usize) -> usize {
4141
});
4242

4343
// Sort-uniquify
44-
luts.sort();
44+
luts.sort_unstable();
4545
luts.dedup();
4646
luts.len()
4747
}
@@ -84,12 +84,12 @@ fn large_level_complexity(table: &[u64], level: usize) -> usize {
8484
});
8585

8686
// Sort-uniquify
87-
luts.sort();
87+
luts.sort_unstable();
8888
luts.dedup();
8989
luts.len()
9090
}
9191

92-
pub fn table_complexity(num_vars: usize, table: &[u64]) -> usize {
92+
pub fn table_bdd_complexity(num_vars: usize, table: &[u64]) -> usize {
9393
let mut complexity: usize = 0;
9494
for level in 1..std::cmp::min(num_vars, 6) {
9595
complexity += level_complexity(table, level);

src/lut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl Lut {
406406

407407
/// Compute the number of nodes in the BDD representing these functions
408408
///
409-
/// Equivalent functions (up to output complementation) are represented by the same BDD node.
409+
/// Equivalent functions (up to output complementation) are represented by a single BDD node.
410410
/// The natural variable order (0 to num_vars) is used: smaller BDDs may be possible with another ordering.
411411
pub fn bdd_complexity(luts: &[Self]) -> usize {
412412
if luts.is_empty() {
@@ -421,7 +421,7 @@ impl Lut {
421421
for l in luts {
422422
table.extend(l.blocks().iter());
423423
}
424-
table_complexity(num_vars, table.as_slice())
424+
table_bdd_complexity(num_vars, table.as_slice())
425425
}
426426

427427
/// Return the hexadecimal string representing the function

src/static_lut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<const NUM_VARS: usize, const NUM_WORDS: usize> StaticLut<NUM_VARS, NUM_WORD
407407
for l in luts {
408408
table.extend(l.blocks().iter());
409409
}
410-
table_complexity(NUM_VARS, table.as_slice())
410+
table_bdd_complexity(NUM_VARS, table.as_slice())
411411
}
412412

413413
/// Return the hexadecimal string representing the function

0 commit comments

Comments
 (0)