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

    // 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> + MinInt

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.

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.

Implementors§