Re:Understanding the x86's Decimal Adjust after Addition (DA...
by userbinator on Tuesday January 31, 2023 @12:52AM
(#34591716)
More than one person noticed the addition of 6, and the significance that has to conversions between ASCII hex and binary, and came up with short (branchless) sequences for doing so using these and the other BCD instructions. This 6-byte sequence featuring DAA is apparently known as "Allison's Algorithm" online, although neither my references nor those I could find online lead me to the actual person of that name:
I believe it faded into obscurity once the shorter 5-byte sequence using DAS instead was discovered:
[ Parent
| on HN ]
Re:Understanding the x86's Decimal Adjust after Addition (DA...
by kens on Tuesday January 31, 2023 @01:38AM
(#34591997)
That's Dennis Allison, who did a bunch of decimal arithmetic work with Knuth. See "Division by 10", Australian Computer Journal, 1992. It unfortunately doesn't give that DAA algorithm, but discusses a bunch of other base-10 stuff.
https://50years.acs.org.au/content/dam/acs/50-years/journals...
Re:Understanding the x86's Decimal Adjust after Addition (DA...
by Sniffnoy on Tuesday January 31, 2023 @02:13PM
(#34600248)
Note that in Allison's Algorithm, that second ADD should actually be an ADC. (I say this both because that's what's in the original paper and because checking it myself that's what works -- it's needed to add the 1 for A through F, so you don't get @ through E instead. Didn't check the second one.)