Anyone have a good set of functions for binary-coded decimal arithmetic?
One could increment a 2-digit BCD integer as follows:
x += ((x&15)==9?7:1); // does not check for overflow
or increase a 2-digit BCD integer by a given value as follows:
x += y;
if (((x&15)>9) || ((x&15)<(y&15))) x+=6;
but I want to know if there are faster or more efficient functions than these.
At this point, I am really only interested in 2-digit BCD numbers, though.