pub fn alu_shift_right(d8: u8, flags: Flags, reset_high_bit: bool) -> (u8, Flags) {
    let high_bit = if reset_high_bit { 0 } else { d8 & 0x80 };
    let low_bit = d8 & 0x01;
    let shifted_value = (d8 >> 1) | high_bit;

    let mut new_flags = flags;
    new_flags.set(Flags::ZERO, shifted_value == 0);
    new_flags.set(Flags::SUBTRACT, false);
    new_flags.set(Flags::HALF_CARRY, false);
    new_flags.set(Flags::CARRY, low_bit != 0);

    (shifted_value, new_flags)
}
/// Shift an 8-bit value to the right.
///
Shift an 8-bit value to the right.
Shift an 8 - bit value to the right .
pub fn alu_shift_right(d8: u8, flags: Flags, reset_high_bit: bool) -> (u8, Flags) {
    let high_bit = if reset_high_bit { 0 } else { d8 & 0x80 };
    let low_bit = d8 & 0x01;
    let shifted_value = (d8 >> 1) | high_bit;
    let mut new_flags = flags;
    new_flags.set(Flags::ZERO, shifted_value == 0);
    new_flags.set(Flags::SUBTRACT, false);
    new_flags.set(Flags::HALF_CARRY, false);
    new_flags.set(Flags::CARRY, low_bit != 0);
    (shifted_value, new_flags)
}
pub fn alu_shift_right ( d8 : u8 , flags : Flags , reset_high_bit : bool ) -> ( u8 , Flags ) { let high_bit = if reset_high_bit { 0 } else { d8 & 0x80 } ; let low_bit = d8 & 0x01 ; let shifted_value = ( d8 >> 1 ) | high_bit ; let mut new_flags = flags ; new_flags . set ( Flags :: ZERO , shifted_value == 0 ) ; new_flags . set ( Flags :: SUBTRACT , false ) ; new_flags . set ( Flags :: HALF_CARRY , false ) ; new_flags . set ( Flags :: CARRY , low_bit != 0 ) ; ( shifted_value , new_flags ) }
Shift an 8-bit value to the right.
Shift an 8 - bit value to the right .
d8
u8
flags
Flags
reset_high_bit
bool
d8
u8
flags
Flags
reset_high_bit
bool