Skip to main content

ConstCarryingAdd

Trait ConstCarryingAdd 

Source
pub trait ConstCarryingAdd: Sized {
    // Required method
    fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool);
}
Expand description

Const-compatible addition with carry for extended precision arithmetic.

Performs self + rhs + carry, returning the sum and output carry. This is a full adder operation useful for multi-word addition.

Required Methods§

Source

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Calculates self + rhs + carry, returning (sum, carry_out).

The carry input should be false for normal addition or true to add an additional 1 (carry from a previous addition).

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.

Implementations on Foreign Types§

Source§

impl ConstCarryingAdd for u8

Source§

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Source§

impl ConstCarryingAdd for u16

Source§

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Source§

impl ConstCarryingAdd for u32

Source§

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Source§

impl ConstCarryingAdd for u64

Source§

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Source§

impl ConstCarryingAdd for u128

Source§

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Implementors§

Source§

impl<T: ConstMachineWord + ConstCarryingAdd + MachineWord, const N: usize> ConstCarryingAdd for FixedUInt<T, N>