Skip to content

Commit cac3df7

Browse files
committed
Changed if expression into explicit type conversion (bool -> usize).
1 parent c57c408 commit cac3df7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/twosat.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ impl TwoSat {
1515
}
1616
pub fn add_clause(&mut self, i: usize, f: bool, j: usize, g: bool) {
1717
assert!(i < self.n && j < self.n);
18-
self.scc
19-
.add_edge(2 * i + if f { 0 } else { 1 }, 2 * j + if g { 1 } else { 0 });
20-
self.scc
21-
.add_edge(2 * j + if g { 0 } else { 1 }, 2 * i + if f { 1 } else { 0 });
18+
self.scc.add_edge(2 * i + !f as usize, 2 * j + g as usize);
19+
self.scc.add_edge(2 * j + !g as usize, 2 * i + f as usize);
2220
}
2321
pub fn satisfiable(&mut self) -> bool {
2422
let id = self.scc.scc_ids().1;

0 commit comments

Comments
 (0)