Skip to main content

Condition

Enum Condition 

Source
#[repr(u8)]
pub enum Condition {
Show 16 variants Eq = 0, Ne = 1, Cs = 2, Cc = 3, Mi = 4, Pl = 5, Vs = 6, Vc = 7, Hi = 8, Ls = 9, Ge = 10, Lt = 11, Gt = 12, Le = 13, Al = 14, Nv = 15,
}
Expand description

AArch64 4-bit condition field (B.<cond>, CSEL, CCMP, …).

name() emits the ARM preferred spelling (cs/cc); differential comparison additionally accepts the hs/lo synonyms.

Variants§

§

Eq = 0

Equal (Z == 1).

§

Ne = 1

Not equal (Z == 0).

§

Cs = 2

Carry set / unsigned higher-or-same (hs).

§

Cc = 3

Carry clear / unsigned lower (lo).

§

Mi = 4

Negative.

§

Pl = 5

Positive or zero.

§

Vs = 6

Overflow set.

§

Vc = 7

Overflow clear.

§

Hi = 8

Unsigned higher.

§

Ls = 9

Unsigned lower or same.

§

Ge = 10

Signed greater than or equal.

§

Lt = 11

Signed less than.

§

Gt = 12

Signed greater than.

§

Le = 13

Signed less than or equal.

§

Al = 14

Always.

§

Nv = 15

Always (never as a real condition; B.NV decodes as B.AL).

Implementations§

Source§

impl Condition

Source

pub const fn from_bits(bits: u8) -> Condition

The condition encoded in a 4-bit field (only the low 4 bits are used).

This is total: every value 0..=15 maps to a variant, and any high bits of bits are masked off first.

Source

pub const fn from_u4(bits: u8) -> Condition

Decode the 4-bit condition field. Alias of Condition::from_bits using the ARM ARM’s cond<3:0> naming.

Source

pub const fn as_u4(self) -> u8

The raw 4-bit encoding of this condition (0b0000 for EQ0b1111 for NV).

Source

pub const fn name(self) -> &'static str

The ARM-preferred lowercase spelling ("eq", "cs", …), a &'static str.

Source

pub const fn invert(self) -> Condition

The inverted condition, with its low bit flipped (EQ<->NE, CS<->CC, GE<->LT, …). AL<->NV.

This matches the ARM ARM InvertCond used by alias selection (CSET/CSETM, CSINC/CINC, …): the encoded value is XORed with 1.

Source

pub const fn inverted(self) -> Condition

Compatibility alias of Condition::invert.

Trait Implementations§

Source§

impl Clone for Condition

Source§

fn clone(&self) -> Condition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Condition

Source§

impl Debug for Condition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Condition

Source§

impl Hash for Condition

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Condition

Source§

fn eq(&self, other: &Condition) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Condition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.