1 /*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * %sccs.include.redist.c% 10 */ 11 12 #if defined(LIBC_SCCS) && !defined(lint) 13 static char sccsid[] = "@(#)cmpdi2.c 8.1 (Berkeley) 06/04/93"; 14 #endif /* LIBC_SCCS and not lint */ 15 16 #include "quad.h" 17 18 /* 19 * Return 0, 1, or 2 as a <, =, > b respectively. 20 * Both a and b are considered signed---which means only the high word is 21 * signed. 22 */ 23 int 24 __cmpdi2(a, b) 25 quad_t a, b; 26 { 27 union uu aa, bb; 28 29 aa.q = a; 30 bb.q = b; 31 return (aa.sl[H] < bb.sl[H] ? 0 : aa.sl[H] > bb.sl[H] ? 2 : 32 aa.ul[L] < bb.ul[L] ? 0 : aa.ul[L] > bb.ul[L] ? 2 : 1); 33 } 34