Trait compiler_builtins::int::Int
source · pub(crate) trait Int: Copy + Debug + PartialEq + PartialOrd + AddAssign + SubAssign + BitAndAssign + BitOrAssign + BitXorAssign + 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 SIGNED: bool;
const BITS: u32;
const ZERO: Self;
const ONE: Self;
const MIN: Self;
const MAX: Self;
const FUZZ_LENGTHS: [u8; 20];
const FUZZ_NUM: usize;
Show 15 methods
// Required methods
fn unsigned(self) -> Self::UnsignedInt;
fn from_unsigned(unsigned: Self::UnsignedInt) -> Self;
fn from_bool(b: bool) -> Self;
fn logical_shr(self, other: u32) -> Self;
fn abs_diff(self, other: Self) -> Self::UnsignedInt;
fn is_zero(self) -> bool;
fn wrapping_neg(self) -> 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 wrapping_shr(self, other: u32) -> Self;
fn rotate_left(self, other: u32) -> Self;
fn overflowing_add(self, other: Self) -> (Self, bool);
fn leading_zeros(self) -> u32;
}
Expand description
Trait for some basic operations on integers
Required Associated Types§
sourcetype UnsignedInt: Int
type UnsignedInt: Int
Unsigned version of Self
Required Associated Constants§
const ZERO: Self
const ONE: Self
const MIN: Self
const MAX: Self
sourceconst FUZZ_LENGTHS: [u8; 20]
const FUZZ_LENGTHS: [u8; 20]
LUT used for maximizing the space covered and minimizing the computational cost of fuzzing
in testcrate
. For example, Self = u128 produces [0,1,2,7,8,15,16,31,32,63,64,95,96,111,
112,119,120,125,126,127].
Required Methods§
fn unsigned(self) -> Self::UnsignedInt
fn from_unsigned(unsigned: Self::UnsignedInt) -> Self
fn from_bool(b: bool) -> Self
sourcefn logical_shr(self, other: u32) -> Self
fn logical_shr(self, other: u32) -> Self
Prevents the need for excessive conversions between signed and unsigned
sourcefn abs_diff(self, other: Self) -> Self::UnsignedInt
fn abs_diff(self, other: Self) -> Self::UnsignedInt
Absolute difference between two integers.