pub trait ArithmeticBundleGadgets: FancyArithmetic {
    fn add_bundles(
        &mut self,
        x: &Bundle<Self::Item>,
        y: &Bundle<Self::Item>
    ) -> Result<Bundle<Self::Item>, Self::Error> { ... } fn sub_bundles(
        &mut self,
        x: &Bundle<Self::Item>,
        y: &Bundle<Self::Item>
    ) -> Result<Bundle<Self::Item>, Self::Error> { ... } fn mul_bundles(
        &mut self,
        x: &Bundle<Self::Item>,
        y: &Bundle<Self::Item>
    ) -> Result<Bundle<Self::Item>, Self::Error> { ... } fn mixed_radix_addition(
        &mut self,
        xs: &[Bundle<Self::Item>]
    ) -> Result<Bundle<Self::Item>, Self::Error> { ... } fn mixed_radix_addition_msb_only(
        &mut self,
        xs: &[Bundle<Self::Item>]
    ) -> Result<Self::Item, Self::Error> { ... } fn mask(
        &mut self,
        b: &Self::Item,
        x: &Bundle<Self::Item>
    ) -> Result<Bundle<Self::Item>, Self::Error> { ... } fn eq_bundles(
        &mut self,
        x: &Bundle<Self::Item>,
        y: &Bundle<Self::Item>
    ) -> Result<Self::Item, Self::Error> { ... } }
Expand description

Arithmetic operations on wire bundles, extending the capability of FancyArithmetic operating on individual wires.

Provided Methods

Add two wire bundles pairwise, zipping addition.

In CRT this is plain addition. In binary this is xor.

Subtract two wire bundles, residue by residue.

In CRT this is plain subtraction. In binary this is xor.

Multiply each wire in x with each wire in y, pairwise.

In CRT this is plain multiplication. In binary this is and.

Mixed radix addition.

Mixed radix addition only returning the MSB.

If b=0 then return 0, else return x.

Compute x == y. Returns a wire encoding the result mod 2.

Implementors