snarkvm_circuit_environment::traits

Trait 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§

Required Methods§

Source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§