ack/modules/src/flt_arith/b64_add.c

31 lines
731 B
C
Raw Normal View History

1989-07-10 11:17:19 +00:00
/*
(c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
# include "misc.h"
int
b64_add(e1,e2)
register struct _mantissa *e1,*e2;
{
int overflow;
int carry;
/* add higher pair of 32 bits */
overflow = ucmp(0xFFFFFFFF - e1->flt_h_32, e2->flt_h_32) < 0;
e1->flt_h_32 += e2->flt_h_32;
/* add lower pair of 32 bits */
carry = ucmp(0xFFFFFFFF - e1->flt_l_32, e2->flt_l_32) < 0;
e1->flt_l_32 += e2->flt_l_32;
if ((carry) && ((++e1->flt_h_32 &~0xFFFFFFFF) || e1->flt_h_32 == 0)) {
e1->flt_h_32 = 0;
return(1); /* had a 64 bit overflow */
}
return(overflow); /* return status from higher add */
}