I've been assigned the job of emulating a CPU, and one of the registers is the carry and borrow flag. During addition and subtraction, if carrying or borrowing occurs, the register is set to 1 (true). If no carrying or borrowing occurs, the register is set to 0 (false).
My question is this: is there an easy way in C or C++ to determine if carrying or borrowing occurs during addition and subtraction?