Trait malachite_base::num::conversion::traits::JoinHalves

source ·
pub trait JoinHalves: HasHalf {
    // Required method
    fn join_halves(upper: Self::Half, lower: Self::Half) -> Self;
}
Expand description

Provides a function to join two pieces into a number. For example, two u32s may be joined to form a u64.

Required Methods§

source

fn join_halves(upper: Self::Half, lower: Self::Half) -> Self

Joins two values into a single value; the upper, or most-significant, half comes first.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl JoinHalves for u16

source§

fn join_halves(upper: Self::Half, lower: Self::Half) -> Self

Joins two unsigned integers to form an unsigned integer with twice the width.

Let $W$ be the width of Self (the output type).

$f(x, y) = 2^{W/2} x + y$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl JoinHalves for u32

source§

fn join_halves(upper: Self::Half, lower: Self::Half) -> Self

Joins two unsigned integers to form an unsigned integer with twice the width.

Let $W$ be the width of Self (the output type).

$f(x, y) = 2^{W/2} x + y$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl JoinHalves for u64

source§

fn join_halves(upper: Self::Half, lower: Self::Half) -> Self

Joins two unsigned integers to form an unsigned integer with twice the width.

Let $W$ be the width of Self (the output type).

$f(x, y) = 2^{W/2} x + y$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl JoinHalves for u128

source§

fn join_halves(upper: Self::Half, lower: Self::Half) -> Self

Joins two unsigned integers to form an unsigned integer with twice the width.

Let $W$ be the width of Self (the output type).

$f(x, y) = 2^{W/2} x + y$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§