pub fn alu_swap_8bit(d8: u8, flags: Flags) -> (u8, Flags) {
    let swapped_value = ((d8 & 0x0F) << 4) | ((d8 & 0xF0) >> 4);

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

    (swapped_value, new_flags)
}
/// Swap upper and lower nibbles of an 8-bit value.
///
/// Update flags:
///
/// ## Flags::ZERO
///
/// Set if the result equals zero.
///
/// ## Flags::SUBTRACT
///
/// Reset
///
/// ## Flags::HALF_CARRY
///
/// Reset
///
/// ## Flags::CARRY
///
/// Reset
///
Swap upper and lower nibbles of an 8-bit value.
Update flags.
Swap upper and lower nibbles of an 8 - bit value . Update flags .
pub fn alu_swap_8bit(d8: u8, flags: Flags) -> (u8, Flags) {
    let swapped_value = ((d8 & 0x0F) << 4) | ((d8 & 0xF0) >> 4);
    let mut new_flags = flags;
    new_flags.set(Flags::ZERO, swapped_value == 0);
    new_flags.set(Flags::SUBTRACT, false);
    new_flags.set(Flags::HALF_CARRY, false);
    new_flags.set(Flags::CARRY, false);
    (swapped_value, new_flags)
}
pub fn alu_swap_8bit ( d8 : u8 , flags : Flags ) -> ( u8 , Flags ) { let swapped_value = ( ( d8 & 0x0F ) << 4 ) | ( ( d8 & 0xF0 ) >> 4 ) ; let mut new_flags = flags ; new_flags . set ( Flags :: ZERO , swapped_value == 0 ) ; new_flags . set ( Flags :: SUBTRACT , false ) ; new_flags . set ( Flags :: HALF_CARRY , false ) ; new_flags . set ( Flags :: CARRY , false ) ; ( swapped_value , new_flags ) }
Swap upper and lower nibbles of an 8-bit value.
Swap upper and lower nibbles of an 8 - bit value .
d8
u8
flags
Flags
d8
u8
flags
Flags
flags::zero
Set if the result equals zero.
Set if the result equals zero .
flags::subtract
None
flags::half_carry
None
flags::carry
None