pub(crate) trait HInt: Int {
    type D: DInt<H = Self> + Int;

    // Required methods
    fn widen(self) -> Self::D;
    fn zero_widen(self) -> Self::D;
    fn widen_hi(self) -> Self::D;
    fn zero_widen_mul(self, rhs: Self) -> Self::D;
    fn widen_mul(self, rhs: Self) -> Self::D;
}
Expand description

Trait for integers half the bit width of another integer. This is implemented for all primitives except for u128, because it there is not a larger primitive.

Required Associated Types§

source

type D: DInt<H = Self> + Int

Integer that is double the bit width of the integer this trait is implemented for

Required Methods§

source

fn widen(self) -> Self::D

Widens (using default extension) the integer to have double bit width

source

fn zero_widen(self) -> Self::D

Widens (zero extension only) the integer to have double bit width. This is needed to get around problems with associated type bounds (such as Int<Othersign: DInt>) being unstable

source

fn widen_hi(self) -> Self::D

Widens the integer to have double bit width and shifts the integer into the higher bits

source

fn zero_widen_mul(self, rhs: Self) -> Self::D

Widening multiplication with zero widening. This cannot overflow.

source

fn widen_mul(self, rhs: Self) -> Self::D

Widening multiplication. This cannot overflow.

Implementations on Foreign Types§

source§

impl HInt for i16

§

type D = i32

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for u64

§

type D = u128

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for i32

§

type D = i64

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for u32

§

type D = u64

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for u8

§

type D = u16

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for u16

§

type D = u32

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for i64

§

type D = i128

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

source§

impl HInt for i8

§

type D = i16

source§

fn widen(self) -> Self::D

source§

fn zero_widen(self) -> Self::D

source§

fn widen_hi(self) -> Self::D

source§

fn zero_widen_mul(self, rhs: Self) -> Self::D

source§

fn widen_mul(self, rhs: Self) -> Self::D

Implementors§