Trait Integer

Source
pub trait Integer<T>: ArithmeticOps<T> {
    // Required methods
    fn leading_zeros(self) -> T;
    fn trailing_zeros(self) -> T;
    fn count_ones(self) -> T;
    fn rotl(self, other: T) -> T;
    fn rotr(self, other: T) -> T;
    fn rem(self, other: T) -> Result<T, TrapCode>;
}
Expand description

Integer value.

Required Methods§

Source

fn leading_zeros(self) -> T

Counts leading zeros in the bitwise representation of the value.

Source

fn trailing_zeros(self) -> T

Counts trailing zeros in the bitwise representation of the value.

Source

fn count_ones(self) -> T

Counts 1-bits in the bitwise representation of the value.

Source

fn rotl(self, other: T) -> T

Get left bit rotation result.

Source

fn rotr(self, other: T) -> T

Get right bit rotation result.

Source

fn rem(self, other: T) -> Result<T, TrapCode>

Get division remainder.

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 Integer<i32> for i32

Source§

fn leading_zeros(self) -> i32

Source§

fn trailing_zeros(self) -> i32

Source§

fn count_ones(self) -> i32

Source§

fn rotl(self, other: i32) -> i32

Source§

fn rotr(self, other: i32) -> i32

Source§

fn rem(self, other: i32) -> Result<i32, TrapCode>

Source§

impl Integer<i64> for i64

Source§

fn leading_zeros(self) -> i64

Source§

fn trailing_zeros(self) -> i64

Source§

fn count_ones(self) -> i64

Source§

fn rotl(self, other: i64) -> i64

Source§

fn rotr(self, other: i64) -> i64

Source§

fn rem(self, other: i64) -> Result<i64, TrapCode>

Source§

impl Integer<u32> for u32

Source§

fn leading_zeros(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

fn count_ones(self) -> u32

Source§

fn rotl(self, other: u32) -> u32

Source§

fn rotr(self, other: u32) -> u32

Source§

fn rem(self, other: u32) -> Result<u32, TrapCode>

Source§

impl Integer<u64> for u64

Source§

fn leading_zeros(self) -> u64

Source§

fn trailing_zeros(self) -> u64

Source§

fn count_ones(self) -> u64

Source§

fn rotl(self, other: u64) -> u64

Source§

fn rotr(self, other: u64) -> u64

Source§

fn rem(self, other: u64) -> Result<u64, TrapCode>

Implementors§