-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Bounded static Var ref | ||
use crate::{types::*, var_vector::*}; | ||
|
||
/// Bounded Static Var Ref | ||
pub struct BSVR { | ||
pub var: &'static Var, | ||
pub vi: VarId, | ||
pub possitive: bool, | ||
} | ||
|
||
impl Default for BSVR { | ||
fn default() -> Self { | ||
BSVR { | ||
var: VarRef(0).get_reference(), | ||
vi: 0, | ||
possitive: true, | ||
} | ||
} | ||
} | ||
|
||
impl BSVR { | ||
pub fn new(vi: VarId, possitive: bool) -> Self { | ||
BSVR { | ||
var: VarRef(vi).get_reference(), | ||
vi, | ||
possitive, | ||
} | ||
} | ||
#[inline] | ||
pub fn lit_assigned(&self) -> Option<bool> { | ||
match self.var.assign { | ||
Some(b) if !self.possitive => Some(!b), | ||
ob => ob, | ||
} | ||
} | ||
pub fn as_lit(&self) -> Lit { | ||
Lit::from((self.vi, self.possitive)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters