Trait malachite_base::num::arithmetic::traits::XXXXAddYYYYToZZZZ
source · [−]pub trait XXXXAddYYYYToZZZZ: Sized {
fn xxxx_add_yyyy_to_zzzz(
x_3: Self,
x_2: Self,
x_1: Self,
x_0: Self,
y_3: Self,
y_2: Self,
y_1: Self,
y_0: Self
) -> (Self, Self, Self, Self);
}
Expand description
Adds two numbers, each composed of four Self
values, returning the sum as a quadruple of
Self
values.
The more significant number always comes first. Addition is wrapping, and overflow is not indicated.
Required Methods
fn xxxx_add_yyyy_to_zzzz(
x_3: Self,
x_2: Self,
x_1: Self,
x_0: Self,
y_3: Self,
y_2: Self,
y_1: Self,
y_0: Self
) -> (Self, Self, Self, Self)
Implementations on Foreign Types
sourceimpl XXXXAddYYYYToZZZZ for u8
impl XXXXAddYYYYToZZZZ for u8
sourcefn xxxx_add_yyyy_to_zzzz(
x_3: u8,
x_2: u8,
x_1: u8,
x_0: u8,
y_3: u8,
y_2: u8,
y_1: u8,
y_0: u8
) -> (u8, u8, u8, u8)
fn xxxx_add_yyyy_to_zzzz(
x_3: u8,
x_2: u8,
x_1: u8,
x_0: u8,
y_3: u8,
y_2: u8,
y_1: u8,
y_0: u8
) -> (u8, u8, u8, u8)
Adds two numbers, each composed of four Self
values, returning the sum as a
quadruple of Self
values.
The more significant value always comes first. Addition is wrapping, and overflow is not indicated.
$$
f(x_3, x_2, x_1, x_0, y_2, y_2, y_1, y_0) = (z_3, z_2, z_1, z_0),
$$
where $W$ is Self::WIDTH
,
$x_3, x_2, x_1, x_0, y_3, y_2, y_1, y_0, z_3, z_2, z_1, z_0 < 2^W$, and $$ (2^{3W}x_3 + 2^{2W}x_2 + 2^Wx_1 + x_0) + (2^{3W}y_3 + 2^{2W}y_2 + 2^Wy_1 + y_0) \equiv 2^{3W}z_3 + 2^{2W}z_2 + 2^Wz_1 + z_0 \mod 2^{4W}. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to add_ssssaaaaaaaa
from longlong.h
, FLINT 2.7.1, where
(s3, s2, s1, s0)
is returned.
sourceimpl XXXXAddYYYYToZZZZ for u16
impl XXXXAddYYYYToZZZZ for u16
sourcefn xxxx_add_yyyy_to_zzzz(
x_3: u16,
x_2: u16,
x_1: u16,
x_0: u16,
y_3: u16,
y_2: u16,
y_1: u16,
y_0: u16
) -> (u16, u16, u16, u16)
fn xxxx_add_yyyy_to_zzzz(
x_3: u16,
x_2: u16,
x_1: u16,
x_0: u16,
y_3: u16,
y_2: u16,
y_1: u16,
y_0: u16
) -> (u16, u16, u16, u16)
Adds two numbers, each composed of four Self
values, returning the sum as a
quadruple of Self
values.
The more significant value always comes first. Addition is wrapping, and overflow is not indicated.
$$
f(x_3, x_2, x_1, x_0, y_2, y_2, y_1, y_0) = (z_3, z_2, z_1, z_0),
$$
where $W$ is Self::WIDTH
,
$x_3, x_2, x_1, x_0, y_3, y_2, y_1, y_0, z_3, z_2, z_1, z_0 < 2^W$, and $$ (2^{3W}x_3 + 2^{2W}x_2 + 2^Wx_1 + x_0) + (2^{3W}y_3 + 2^{2W}y_2 + 2^Wy_1 + y_0) \equiv 2^{3W}z_3 + 2^{2W}z_2 + 2^Wz_1 + z_0 \mod 2^{4W}. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to add_ssssaaaaaaaa
from longlong.h
, FLINT 2.7.1, where
(s3, s2, s1, s0)
is returned.
sourceimpl XXXXAddYYYYToZZZZ for u32
impl XXXXAddYYYYToZZZZ for u32
sourcefn xxxx_add_yyyy_to_zzzz(
x_3: u32,
x_2: u32,
x_1: u32,
x_0: u32,
y_3: u32,
y_2: u32,
y_1: u32,
y_0: u32
) -> (u32, u32, u32, u32)
fn xxxx_add_yyyy_to_zzzz(
x_3: u32,
x_2: u32,
x_1: u32,
x_0: u32,
y_3: u32,
y_2: u32,
y_1: u32,
y_0: u32
) -> (u32, u32, u32, u32)
Adds two numbers, each composed of four Self
values, returning the sum as a
quadruple of Self
values.
The more significant value always comes first. Addition is wrapping, and overflow is not indicated.
$$
f(x_3, x_2, x_1, x_0, y_2, y_2, y_1, y_0) = (z_3, z_2, z_1, z_0),
$$
where $W$ is Self::WIDTH
,
$x_3, x_2, x_1, x_0, y_3, y_2, y_1, y_0, z_3, z_2, z_1, z_0 < 2^W$, and $$ (2^{3W}x_3 + 2^{2W}x_2 + 2^Wx_1 + x_0) + (2^{3W}y_3 + 2^{2W}y_2 + 2^Wy_1 + y_0) \equiv 2^{3W}z_3 + 2^{2W}z_2 + 2^Wz_1 + z_0 \mod 2^{4W}. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to add_ssssaaaaaaaa
from longlong.h
, FLINT 2.7.1, where
(s3, s2, s1, s0)
is returned.
sourceimpl XXXXAddYYYYToZZZZ for u64
impl XXXXAddYYYYToZZZZ for u64
sourcefn xxxx_add_yyyy_to_zzzz(
x_3: u64,
x_2: u64,
x_1: u64,
x_0: u64,
y_3: u64,
y_2: u64,
y_1: u64,
y_0: u64
) -> (u64, u64, u64, u64)
fn xxxx_add_yyyy_to_zzzz(
x_3: u64,
x_2: u64,
x_1: u64,
x_0: u64,
y_3: u64,
y_2: u64,
y_1: u64,
y_0: u64
) -> (u64, u64, u64, u64)
Adds two numbers, each composed of four Self
values, returning the sum as a
quadruple of Self
values.
The more significant value always comes first. Addition is wrapping, and overflow is not indicated.
$$
f(x_3, x_2, x_1, x_0, y_2, y_2, y_1, y_0) = (z_3, z_2, z_1, z_0),
$$
where $W$ is Self::WIDTH
,
$x_3, x_2, x_1, x_0, y_3, y_2, y_1, y_0, z_3, z_2, z_1, z_0 < 2^W$, and $$ (2^{3W}x_3 + 2^{2W}x_2 + 2^Wx_1 + x_0) + (2^{3W}y_3 + 2^{2W}y_2 + 2^Wy_1 + y_0) \equiv 2^{3W}z_3 + 2^{2W}z_2 + 2^Wz_1 + z_0 \mod 2^{4W}. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to add_ssssaaaaaaaa
from longlong.h
, FLINT 2.7.1, where
(s3, s2, s1, s0)
is returned.
sourceimpl XXXXAddYYYYToZZZZ for u128
impl XXXXAddYYYYToZZZZ for u128
sourcefn xxxx_add_yyyy_to_zzzz(
x_3: u128,
x_2: u128,
x_1: u128,
x_0: u128,
y_3: u128,
y_2: u128,
y_1: u128,
y_0: u128
) -> (u128, u128, u128, u128)
fn xxxx_add_yyyy_to_zzzz(
x_3: u128,
x_2: u128,
x_1: u128,
x_0: u128,
y_3: u128,
y_2: u128,
y_1: u128,
y_0: u128
) -> (u128, u128, u128, u128)
Adds two numbers, each composed of four Self
values, returning the sum as a
quadruple of Self
values.
The more significant value always comes first. Addition is wrapping, and overflow is not indicated.
$$
f(x_3, x_2, x_1, x_0, y_2, y_2, y_1, y_0) = (z_3, z_2, z_1, z_0),
$$
where $W$ is Self::WIDTH
,
$x_3, x_2, x_1, x_0, y_3, y_2, y_1, y_0, z_3, z_2, z_1, z_0 < 2^W$, and $$ (2^{3W}x_3 + 2^{2W}x_2 + 2^Wx_1 + x_0) + (2^{3W}y_3 + 2^{2W}y_2 + 2^Wy_1 + y_0) \equiv 2^{3W}z_3 + 2^{2W}z_2 + 2^Wz_1 + z_0 \mod 2^{4W}. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to add_ssssaaaaaaaa
from longlong.h
, FLINT 2.7.1, where
(s3, s2, s1, s0)
is returned.
sourceimpl XXXXAddYYYYToZZZZ for usize
impl XXXXAddYYYYToZZZZ for usize
sourcefn xxxx_add_yyyy_to_zzzz(
x_3: usize,
x_2: usize,
x_1: usize,
x_0: usize,
y_3: usize,
y_2: usize,
y_1: usize,
y_0: usize
) -> (usize, usize, usize, usize)
fn xxxx_add_yyyy_to_zzzz(
x_3: usize,
x_2: usize,
x_1: usize,
x_0: usize,
y_3: usize,
y_2: usize,
y_1: usize,
y_0: usize
) -> (usize, usize, usize, usize)
Adds two numbers, each composed of four usize
values, returning the sum as a quadruple
of usize
values.
The more significant value always comes first. Addition is wrapping, and overflow is not indicated.
$$
f(x_3, x_2, x_1, x_0, y_2, y_2, y_1, y_0) = (z_3, z_2, z_1, z_0),
$$
where $W$ is Self::WIDTH
,
$x_3, x_2, x_1, x_0, y_3, y_2, y_1, y_0, z_3, z_2, z_1, z_0 < 2^W$, and $$ (2^{3W}x_3 + 2^{2W}x_2 + 2^Wx_1 + x_0) + (2^{3W}y_3 + 2^{2W}y_2 + 2^Wy_1 + y_0) \equiv 2^{3W}z_3 + 2^{2W}z_2 + 2^Wz_1 + z_0 \mod 2^{4W}. $$
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to add_ssssaaaaaaaa
from longlong.h
, FLINT 2.7.1, where
(s3, s2, s1, s0)
is returned.