Repository navigation
<
8000
div class="prc-PageLayout-HorizontalDivider-JLVqp prc-PageLayout-PaneHorizontalDivider-9tbnE" data-component="PageLayout.HorizontalDivider" data-variant-regular="none" data-variant-narrow="none" data-position="start" style="--spacing-divider:var(--spacing-none);--spacing:var(--spacing-none)">
Expand file tree
/
Copy pathadder.c
More file actions
executable file
·50 lines (43 loc) · 1.05 KB
/
Copy pathadder.c
File metadata and controls
executable file
·50 lines (43 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
/*
* these are the routines the routines to do 32 and 64-bit addition
*/
# ifdef EXT_DEBUG
# include <stdio.h>
# endif
# include "FP_types.h"
# define UNKNOWN -1
# define TRUE 1
# define FALSE 0
# define MAXBIT 0x80000000L
/*
* add 64 bits
*/
int
b64_add(e1,e2)
/*
* pointers to 64 bit 'registers'
*/
register B64 *e1,*e2;
{
register int overflow;
int carry;
/* add higher pair of 32 bits */
overflow = ((unsigned long) 0xFFFFFFFF - e1->h_32 < e2->h_32);
e1->h_32 += e2->h_32;
/* add lower pair of 32 bits */
carry = ((unsigned long) 0xFFFFFFFF - e1->l_32 < e2->l_32);
e1->l_32 += e2->l_32;
# ifdef EXT_DEBUG
printf("\t\t\t\t\tb64_add: overflow (%d); internal carry(%d)\n",
overflow,carry);
fflush(stdout);
# endif
if ((carry) && (++e1->h_32 == 0))
return(TRUE); /* had a 64 bit overflow */
return(overflow); /* return status from higher add */
}