fn add(cpu: &mut Cpu, a: i16, b: i16) -> i16 {
    let (res, o) = a.overflowing_add(b);
    cpu.set_overflow(o);
    cpu.set_carry((a as u16).checked_add(b as u16).is_none());
    res
}
/// Add two values and set the flags accordingly
Add two values and set the flags accordingly
Add two values and set the flags accordingly
fn add(cpu: &mut Cpu, a: i16, b: i16) -> i16 {
    let (res, o) = a.overflowing_add(b);
    cpu.set_overflow(o);
    cpu.set_carry((a as u16).checked_add(b as u16).is_none());
    res
}
fn add ( cpu : & mut Cpu , a : i16 , b : i16 ) -> i16 { let ( res , o ) = a . overflowing_add ( b ) ; cpu . set_overflow ( o ) ; cpu . set_carry ( ( a as u16 ) . checked_add ( b as u16 ) . is_none ( ) ) ; res }
Add two values and set the flags accordingly
Add two values and set the flags accordingly
cpu
&mut Cpu
a
i16
b
i16
cpu
&mut Cpu
a
i16
b
i16