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.

Implementors§

source§

impl<E> Adder for Boolean<E>where E: Environment,

§

type Carry = Boolean<E>

§

type Sum = Boolean<E>