#[allow(clippy::missing_inline_in_public_items)]
#[derive(Clone, Copy, Debug)]
pub struct Apsr {
bits: u32,
}
impl Apsr {
#[inline]
pub fn bits(self) -> u32 {
self.bits
}
#[inline]
pub fn q(self) -> bool {
self.bits & (1 << 27) == (1 << 27)
}
#[inline]
pub fn v(self) -> bool {
self.bits & (1 << 28) == (1 << 28)
}
#[inline]
pub fn c(self) -> bool {
self.bits & (1 << 29) == (1 << 29)
}
#[inline]
pub fn z(self) -> bool {
self.bits & (1 << 30) == (1 << 30)
}
#[inline]
pub fn n(self) -> bool {
self.bits & (1 << 31) == (1 << 31)
}
}
#[inline]
pub fn read() -> Apsr {
match () {
#[cfg(cortex_m)]
() => {
let r: u32;
unsafe {
llvm_asm!("mrs $0, APSR" : "=r"(r) ::: "volatile");
}
Apsr { bits: r }
}
#[cfg(not(cortex_m))]
() => unimplemented!(),
}
}