[][src]Trait compiler_builtins::int::Int

pub trait Int: Copy + PartialEq + PartialOrd + AddAssign + BitAndAssign + BitOrAssign + ShlAssign<i32> + ShrAssign<u32> + Add<Output = Self> + Sub<Output = Self> + Div<Output = Self> + Shl<u32, Output = Self> + Shr<u32, Output = Self> + BitOr<Output = Self> + BitXor<Output = Self> + BitAnd<Output = Self> + Not<Output = Self> {
type OtherSign: Int;
type UnsignedInt: Int;

const BITS: u32;
const ZERO: Self;
const ONE: Self;

    fn extract_sign(self) -> (bool, Self::UnsignedInt);
fn unsigned(self) -> Self::UnsignedInt;
fn from_unsigned(unsigned: Self::UnsignedInt) -> Self;
fn from_bool(b: bool) -> Self;
fn max_value() -> Self;
fn min_value() -> Self;
fn wrapping_add(self, other: Self) -> Self;
fn wrapping_mul(self, other: Self) -> Self;
fn wrapping_sub(self, other: Self) -> Self;
fn wrapping_shl(self, other: u32) -> Self;
fn overflowing_add(self, other: Self) -> (Self, bool);
fn aborting_div(self, other: Self) -> Self;
fn aborting_rem(self, other: Self) -> Self;
fn leading_zeros(self) -> u32; }
🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Trait for some basic operations on integers

Associated Types

type OtherSign: Int

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Type with the same width but other signedness

type UnsignedInt: Int

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Unsigned version of Self

Loading content...

Associated Constants

const BITS: u32

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

The bitwidth of the int type

const ZERO: Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

const ONE: Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Loading content...

Required methods

fn extract_sign(self) -> (bool, Self::UnsignedInt)

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Extracts the sign from self and returns a tuple.

Examples

This example is not tested
let i = -25_i32;
let (sign, u) = i.extract_sign();
assert_eq!(sign, true);
assert_eq!(u, 25_u32);Run

fn unsigned(self) -> Self::UnsignedInt

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn from_unsigned(unsigned: Self::UnsignedInt) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn from_bool(b: bool) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn max_value() -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn min_value() -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn wrapping_add(self, other: Self) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn wrapping_mul(self, other: Self) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn wrapping_sub(self, other: Self) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn wrapping_shl(self, other: u32) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn overflowing_add(self, other: Self) -> (Self, bool)

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn aborting_div(self, other: Self) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn aborting_rem(self, other: Self) -> Self

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

fn leading_zeros(self) -> u32

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Loading content...

Implementors

impl Int for i32[src]

type OtherSign = u32

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

type UnsignedInt = u32

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

impl Int for i64[src]

type OtherSign = u64

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

type UnsignedInt = u64

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

impl Int for i128[src]

type OtherSign = u128

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

type UnsignedInt = u128

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

impl Int for u32[src]

type OtherSign = i32

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

type UnsignedInt = u32

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

impl Int for u64[src]

type OtherSign = i64

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

type UnsignedInt = u64

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

impl Int for u128[src]

type OtherSign = i128

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

type UnsignedInt = u128

🔬 This is a nightly-only experimental API. (compiler_builtins_lib)

Compiler builtins. Will never become stable.

Loading content...