no need for fanciness

This commit is contained in:
sinuio
2022-02-07 09:32:49 -08:00
parent 8aa4fd09cc
commit 9af3882a0a

View File

@@ -6,17 +6,17 @@ pub type Bool = u8;
impl GateOps for Bool {
/// XOR `self` and `x`
fn xor(&self, x: &Bool) -> Result<Bool, GateOpsError> {
Ok((self + x) % 2)
Ok(self ^ x)
}
/// INV `self`
fn inv(&self) -> Result<Bool, GateOpsError> {
Ok((1 + self) % 2)
Ok(self ^ 1)
}
/// AND `self` and `x`
fn and(&self, x: &Bool) -> Result<Bool, GateOpsError> {
Ok(self * x)
Ok(self & x)
}
}