snarkvm_circuit_environment::traits

Trait Adder

Source
pub trait Adder {
    type Carry;
    type Sum;

    // Required method
    fn adder(&self, other: &Self, carry: &Self) -> (Self::Sum, Self::Carry);
}
Expand description

A single-bit binary adder with a carry bit.

https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder

sum = (a XOR b) XOR carry carry = a AND b OR carry AND (a XOR b) return (sum, carry)

Required Associated Types§

Required Methods§

Source

fn adder(&self, other: &Self, carry: &Self) -> (Self::Sum, Self::Carry)

Returns the sum of self and other as a sum bit and carry 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§