pub enum IntPred {
Eq,
Ne,
Slt,
Sle,
Sgt,
Sge,
Ult,
Ule,
Ugt,
Uge,
}Expand description
The ten integer comparisons.
Signedness is on the predicate rather than on the type, for the same reason it is on
sdiv and udiv: the type space is halved and the operation says what it means.
Variants§
Eq
Equal.
Ne
Not equal.
Slt
Signed less than.
Sle
Signed less than or equal.
Sgt
Signed greater than.
Sge
Signed greater than or equal.
Ult
Unsigned less than.
Ule
Unsigned less than or equal.
Ugt
Unsigned greater than.
Uge
Unsigned greater than or equal.
Implementations§
Source§impl IntPred
impl IntPred
Sourcepub const fn swapped(self) -> Self
pub const fn swapped(self) -> Self
The predicate that holds when the operands are given the other way round.
Sourcepub const fn is_signed(self) -> bool
pub const fn is_signed(self) -> bool
Whether this reads its operands as signed. Equality reads them as neither.
Sourcepub const fn unsigned(self) -> Self
pub const fn unsigned(self) -> Self
The predicate that asks the same question with the bits read as unsigned.
Each ordering has a counterpart the other way round and equality is the same question at both readings, so every predicate has one and nothing here is a refusal. What it is for is operands known not to be negative: the two readings agree on those, so a signed comparison of two of them is the unsigned comparison of them, and the unsigned one is the one that still holds when the same values are looked at in fewer bits.