Trait XMulYToZZ

Source
pub trait XMulYToZZ: Sized {
    // Required method
    fn x_mul_y_to_zz(x: Self, y: Self) -> (Self, Self);
}
Expand description

Multiplies two numbers, returning the product as a pair of Self values.

The more significant number always comes first.

Required Methods§

Source

fn x_mul_y_to_zz(x: Self, y: Self) -> (Self, Self)

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 XMulYToZZ for u8

Source§

fn x_mul_y_to_zz(x: u8, y: u8) -> (u8, u8)

Multiplies two numbers, returning the product as a pair of Self values.

The more significant value always comes first.

$$ f(x, y) = (z_1, z_0), $$ where $W$ is Self::WIDTH,

$x, y, z_1, z_0 < 2^W$, and $$ xy = 2^Wz_1 + z_0. $$

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

This is equivalent to umul_ppmm from longlong.h, GMP 6.2.1, where (w1, w0) is returned.

Source§

impl XMulYToZZ for u16

Source§

fn x_mul_y_to_zz(x: u16, y: u16) -> (u16, u16)

Multiplies two numbers, returning the product as a pair of Self values.

The more significant value always comes first.

$$ f(x, y) = (z_1, z_0), $$ where $W$ is Self::WIDTH,

$x, y, z_1, z_0 < 2^W$, and $$ xy = 2^Wz_1 + z_0. $$

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

This is equivalent to umul_ppmm from longlong.h, GMP 6.2.1, where (w1, w0) is returned.

Source§

impl XMulYToZZ for u32

Source§

fn x_mul_y_to_zz(x: u32, y: u32) -> (u32, u32)

Multiplies two numbers, returning the product as a pair of Self values.

The more significant value always comes first.

$$ f(x, y) = (z_1, z_0), $$ where $W$ is Self::WIDTH,

$x, y, z_1, z_0 < 2^W$, and $$ xy = 2^Wz_1 + z_0. $$

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

This is equivalent to umul_ppmm from longlong.h, GMP 6.2.1, where (w1, w0) is returned.

Source§

impl XMulYToZZ for u64

Source§

fn x_mul_y_to_zz(x: u64, y: u64) -> (u64, u64)

Multiplies two numbers, returning the product as a pair of Self values.

The more significant value always comes first.

$$ f(x, y) = (z_1, z_0), $$ where $W$ is Self::WIDTH,

$x, y, z_1, z_0 < 2^W$, and $$ xy = 2^Wz_1 + z_0. $$

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

This is equivalent to umul_ppmm from longlong.h, GMP 6.2.1, where (w1, w0) is returned.

Source§

impl XMulYToZZ for u128

Source§

fn x_mul_y_to_zz(x: u128, y: u128) -> (u128, u128)

Multiplies two numbers, returning the product as a pair of u128 values.

The more significant value always comes first.

$$ f(x, y) = (z_1, z_0), $$ where $W$ is Self::WIDTH,

$x, y, z_1, z_0 < 2^W$, and $$ xy = 2^Wz_1 + z_0. $$

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

This is equivalent to umul_ppmm from longlong.h, GMP 6.2.1, where (w1, w0) is returned.

Source§

impl XMulYToZZ for usize

Source§

fn x_mul_y_to_zz(x: usize, y: usize) -> (usize, usize)

Multiplies two numbers, returning the product as a pair of usize values.

The more significant value always comes first.

$$ f(x, y) = (z_1, z_0), $$ where $W$ is Self::WIDTH,

$x, y, z_1, z_0 < 2^W$, and $$ xy = 2^Wz_1 + z_0. $$

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

This is equivalent to umul_ppmm from longlong.h, GMP 6.2.1, where (w1, w0) is returned.

Implementors§