Trait snarkvm_circuit::operators::Subtractor
source · pub trait Subtractor {
type Borrow;
type Difference;
// Required method
fn subtractor(
&self,
other: &Self,
borrow: &Self
) -> (Self::Difference, Self::Borrow);
}
Expand description
A single-bit binary subtractor with a borrow bit.
https://en.wikipedia.org/wiki/Subtractor#Full_subtractor
difference = (a XOR b) XOR borrow borrow = ((NOT a) AND b) OR (borrow AND (NOT (a XOR b))) return (difference, borrow)
Required Associated Types§
type Borrow
type Difference
Required Methods§
sourcefn subtractor(
&self,
other: &Self,
borrow: &Self
) -> (Self::Difference, Self::Borrow)
fn subtractor( &self, other: &Self, borrow: &Self ) -> (Self::Difference, Self::Borrow)
Returns the difference of self
and other
as a difference bit and borrow bit.