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§

source

type OtherSign: Int

Type with the same width but other signedness

source

type UnsignedInt: Int

Unsigned version of Self

Required Associated Constants§

source

const SIGNED: bool

If Self is a signed integer

source

const BITS: u32

The bitwidth of the int type

source

const ZERO: Self

source

const ONE: Self

source

const MIN: Self

source

const MAX: Self

source

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].

source

const FUZZ_NUM: usize

The number of entries of FUZZ_LENGTHS actually used. The maximum is 20 for u128.

Required Methods§

source

fn unsigned(self) -> Self::UnsignedInt

source

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

source

fn from_bool(b: bool) -> Self

source

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

Prevents the need for excessive conversions between signed and unsigned

source

fn abs_diff(self, other: Self) -> Self::UnsignedInt

Absolute difference between two integers.

source

fn is_zero(self) -> bool

source

fn wrapping_neg(self) -> Self

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

fn leading_zeros(self) -> u32

Implementations on Foreign Types§

source§

impl Int for i8

§

type OtherSign = u8

§

type UnsignedInt = u8

source§

fn unsigned(self) -> u8

source§

fn from_unsigned(me: u8) -> Self

source§

fn abs_diff(self, other: Self) -> u8

source§

const BITS: u32 = 8u32

source§

const SIGNED: bool = true

source§

const ZERO: Self = 0i8

source§

const ONE: Self = 1i8

source§

const MIN: Self = -128i8

source§

const MAX: Self = 127i8

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 6usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for isize

§

type OtherSign = usize

§

type UnsignedInt = usize

source§

fn unsigned(self) -> usize

source§

fn from_unsigned(me: usize) -> Self

source§

fn abs_diff(self, other: Self) -> usize

source§

const BITS: u32 = 64u32

source§

const SIGNED: bool = true

source§

const ZERO: Self = 0isize

source§

const ONE: Self = 1isize

source§

const MIN: Self = -9_223_372_036_854_775_808isize

source§

const MAX: Self = 9_223_372_036_854_775_807isize

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 16usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for u32

§

type OtherSign = i32

§

type UnsignedInt = u32

source§

fn unsigned(self) -> u32

source§

fn from_unsigned(me: u32) -> Self

source§

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

source§

const BITS: u32 = 32u32

source§

const SIGNED: bool = false

source§

const ZERO: Self = 0u32

source§

const ONE: Self = 1u32

source§

const MIN: Self = 0u32

source§

const MAX: Self = 4_294_967_295u32

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 12usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for i64

§

type OtherSign = u64

§

type UnsignedInt = u64

source§

fn unsigned(self) -> u64

source§

fn from_unsigned(me: u64) -> Self

source§

fn abs_diff(self, other: Self) -> u64

source§

const BITS: u32 = 64u32

source§

const SIGNED: bool = true

source§

const ZERO: Self = 0i64

source§

const ONE: Self = 1i64

source§

const MIN: Self = -9_223_372_036_854_775_808i64

source§

const MAX: Self = 9_223_372_036_854_775_807i64

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 16usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for i128

§

type OtherSign = u128

§

type UnsignedInt = u128

source§

fn unsigned(self) -> u128

source§

fn from_unsigned(me: u128) -> Self

source§

fn abs_diff(self, other: Self) -> u128

source§

const BITS: u32 = 128u32

source§

const SIGNED: bool = true

source§

const ZERO: Self = 0i128

source§

const ONE: Self = 1i128

source§

const MIN: Self = -170_141_183_460_469_231_731_687_303_715_884_105_728i128

source§

const MAX: Self = 170_141_183_460_469_231_731_687_303_715_884_105_727i128

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 20usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for u8

§

type OtherSign = i8

§

type UnsignedInt = u8

source§

fn unsigned(self) -> u8

source§

fn from_unsigned(me: u8) -> Self

source§

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

source§

const BITS: u32 = 8u32

source§

const SIGNED: bool = false

source§

const ZERO: Self = 0u8

source§

const ONE: Self = 1u8

source§

const MIN: Self = 0u8

source§

const MAX: Self = 255u8

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 6usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for usize

§

type OtherSign = isize

§

type UnsignedInt = usize

source§

fn unsigned(self) -> usize

source§

fn from_unsigned(me: usize) -> Self

source§

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

source§

const BITS: u32 = 64u32

source§

const SIGNED: bool = false

source§

const ZERO: Self = 0usize

source§

const ONE: Self = 1usize

source§

const MIN: Self = 0usize

source§

const MAX: Self = 18_446_744_073_709_551_615usize

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 16usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for u128

§

type OtherSign = i128

§

type UnsignedInt = u128

source§

fn unsigned(self) -> u128

source§

fn from_unsigned(me: u128) -> Self

source§

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

source§

const BITS: u32 = 128u32

source§

const SIGNED: bool = false

source§

const ZERO: Self = 0u128

source§

const ONE: Self = 1u128

source§

const MIN: Self = 0u128

source§

const MAX: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 20usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for u64

§

type OtherSign = i64

§

type UnsignedInt = u64

source§

fn unsigned(self) -> u64

source§

fn from_unsigned(me: u64) -> Self

source§

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

source§

const BITS: u32 = 64u32

source§

const SIGNED: bool = false

source§

const ZERO: Self = 0u64

source§

const ONE: Self = 1u64

source§

const MIN: Self = 0u64

source§

const MAX: Self = 18_446_744_073_709_551_615u64

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 16usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for u16

§

type OtherSign = i16

§

type UnsignedInt = u16

source§

fn unsigned(self) -> u16

source§

fn from_unsigned(me: u16) -> Self

source§

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

source§

const BITS: u32 = 16u32

source§

const SIGNED: bool = false

source§

const ZERO: Self = 0u16

source§

const ONE: Self = 1u16

source§

const MIN: Self = 0u16

source§

const MAX: Self = 65_535u16

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 8usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for i32

§

type OtherSign = u32

§

type UnsignedInt = u32

source§

fn unsigned(self) -> u32

source§

fn from_unsigned(me: u32) -> Self

source§

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

source§

const BITS: u32 = 32u32

source§

const SIGNED: bool = true

source§

const ZERO: Self = 0i32

source§

const ONE: Self = 1i32

source§

const MIN: Self = -2_147_483_648i32

source§

const MAX: Self = 2_147_483_647i32

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 12usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

source§

impl Int for i16

§

type OtherSign = u16

§

type UnsignedInt = u16

source§

fn unsigned(self) -> u16

source§

fn from_unsigned(me: u16) -> Self

source§

fn abs_diff(self, other: Self) -> u16

source§

const BITS: u32 = 16u32

source§

const SIGNED: bool = true

source§

const ZERO: Self = 0i16

source§

const ONE: Self = 1i16

source§

const MIN: Self = -32_768i16

source§

const MAX: Self = 32_767i16

source§

const FUZZ_LENGTHS: [u8; 20] = _

source§

const FUZZ_NUM: usize = 8usize

source§

fn from_bool(b: bool) -> Self

source§

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

source§

fn is_zero(self) -> bool

source§

fn wrapping_neg(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn leading_zeros(self) -> u32

Implementors§