BIT instruction

This commit is contained in:
2022-11-24 23:10:02 -05:00
parent e9f3cd24c7
commit 0ea8fdca2c
4 changed files with 97 additions and 6 deletions
+5
View File
@@ -8,6 +8,7 @@ pub trait SnesNum: Copy + Clone + Sized + Eq + PartialEq {
fn asl(&self) -> Self;
fn is_negative(&self) -> bool;
fn is_zero(&self) -> bool;
fn next_to_highest_bit(&self) -> bool;
fn to_u32(&self) -> u32;
fn from_u32(v: u32) -> Self;
fn invert(&self) -> Self;
@@ -74,6 +75,10 @@ macro_rules! define_impl {
(*self) == 0
}
fn next_to_highest_bit(&self) -> bool {
((*self) << 1) & !(<$t>::MAX >> 1) != 0
}
fn to_u32(&self) -> u32 {
(* self) as u32
}