xref: /csrg-svn/lib/libc/quad/cmpdi2.c (revision 53434)
1*53434Sbostic /*-
2*53434Sbostic  * Copyright (c) 1992 The Regents of the University of California.
3*53434Sbostic  * All rights reserved.
4*53434Sbostic  *
5*53434Sbostic  * %sccs.include.redist.c%
6*53434Sbostic  */
7*53434Sbostic 
8*53434Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*53434Sbostic static char sccsid[] = "@(#)cmpdi2.c	5.1 (Berkeley) 05/12/92";
10*53434Sbostic #endif /* LIBC_SCCS and not lint */
11*53434Sbostic 
12*53434Sbostic #include "longlong.h"
13*53434Sbostic 
14*53434Sbostic SItype
15*53434Sbostic __cmpdi2 (a, b)
16*53434Sbostic      long long a, b;
17*53434Sbostic {
18*53434Sbostic   long_long au, bu;
19*53434Sbostic 
20*53434Sbostic   au.ll = a, bu.ll = b;
21*53434Sbostic 
22*53434Sbostic   if (au.s.high < bu.s.high)
23*53434Sbostic     return 0;
24*53434Sbostic   else if (au.s.high > bu.s.high)
25*53434Sbostic     return 2;
26*53434Sbostic   if ((unsigned) au.s.low < (unsigned) bu.s.low)
27*53434Sbostic     return 0;
28*53434Sbostic   else if ((unsigned) au.s.low > (unsigned) bu.s.low)
29*53434Sbostic     return 2;
30*53434Sbostic   return 1;
31*53434Sbostic }
32