use crate::Ins;
impl Ins {
pub fn discriminant(&self) -> u16 {
unsafe { *(self as *const Self as *const u16) }
}
pub fn is_branch(&self) -> bool {
match self {
Ins::Bt { .. }
| Ins::Bf { .. }
| Ins::Bra { .. }
| Ins::Bsr { .. }
| Ins::JmpAtRn { .. }
| Ins::JsrAtRn { .. }
| Ins::Trapa { .. }
| Ins::Rts
| Ins::Rte => true,
#[cfg(feature = "sh2")]
Ins::BrafRn { .. } | Ins::BsrfRn { .. } | Ins::Bts { .. } | Ins::Bfs { .. } => true,
_ => false,
}
}
pub fn is_delayed_branch(&self) -> bool {
match self {
Ins::Bra { .. }
| Ins::Bsr { .. }
| Ins::JmpAtRn { .. }
| Ins::JsrAtRn { .. }
| Ins::Rts
| Ins::Rte => true,
#[cfg(feature = "sh2")]
Ins::BrafRn { .. } | Ins::BsrfRn { .. } | Ins::Bts { .. } | Ins::Bfs { .. } => true,
_ => false,
}
}
}