This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Algol Front end
- From: dewar at gnat dot com (Robert Dewar)
- To: Arthur_I_Schwarz at raytheon dot com, gcc at gcc dot gnu dot org, tej at melbpc dot org dot au
- Date: Tue, 7 May 2002 22:42:31 -0400 (EDT)
- Subject: Re: Algol Front end
Table lookup is not the way to go for packed decimal addition.
Basically you want to do a standard addition, and then deal with the carries.
There are two cases of carries
1. Where there is a carry out of the four bits. Two subcases here
100? + 100? => overflow, easily detected by an AND
1001 + 0111 (or vice versa), detectable by some sequence of logical
fiddling
2. Where the carry is within the four bits, i.e. the result is 11?? or 101?
(again detectable by some logical fiddling)
That's as far as I have time to get right now, but starting from this, you
can figure out a series of logical operations to effect the carry adjust.