pub trait ArithmeticBundleGadgets: FancyArithmetic {
// Provided methods
fn add_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
) -> Bundle<Self::Item> { ... }
fn sub_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
) -> Bundle<Self::Item> { ... }
fn mul_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>> { ... }
fn mask(
&mut self,
b: &Self::Item,
x: &Bundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>> { ... }
}Expand description
Arithmetic operations on wire bundles, extending the capability of FancyArithmetic operating
on individual wires.
Provided Methods§
Sourcefn add_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
) -> Bundle<Self::Item>
fn add_bundles( &mut self, x: &Bundle<Self::Item>, y: &Bundle<Self::Item>, ) -> Bundle<Self::Item>
Add two wire bundles pairwise, zipping addition.
In CRT this is plain addition. In binary this is xor.
§Panics
Panics if x and y are not of the same length.
Sourcefn sub_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
) -> Bundle<Self::Item>
fn sub_bundles( &mut self, x: &Bundle<Self::Item>, y: &Bundle<Self::Item>, ) -> Bundle<Self::Item>
Subtract two wire bundles, residue by residue.
In CRT this is plain subtraction. In binary this is xor.
§Panics
Panics if x and y are not of the same length.