Patent ID: 8539015

Claim:
A method of performing a binary-coded decimal (BCD) addition, comprising: receiving, in a processor, first and second values on which the BCD addition is to be performed; adding the first value to a sequence of constant digits to produce a modified first value; adding the modified first value and the second value to produce a sum having BCD digits; determining which of the BCD digits of the sum is not associated with a carry, wherein the determining comprises performing an operation on the modified first value, the second value, and the sum, and using a result of the operation to identify which of the BCD digits of the sum is not associated with a carry; storing a carry resulting from the adding of the modified first value and the second value in a flag register of the processor, where the carry stored in the flag register is a value to be transferred to a next most significant BCD digit; using the carry stored in the flag register to compute a result of the BCD addition; and subtracting corresponding constant digits from BCD digits of the result of the BCD addition for those BCD digits of the result that are not associated with a carry as identified by the determining.