153434Sbostic /*- 253434Sbostic * Copyright (c) 1992 The Regents of the University of California. 353434Sbostic * All rights reserved. 453434Sbostic * 5*53794Sbostic * This software was developed by the Computer Systems Engineering group 6*53794Sbostic * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7*53794Sbostic * contributed to Berkeley. 8*53794Sbostic * 953434Sbostic * %sccs.include.redist.c% 1053434Sbostic */ 1153434Sbostic 1253434Sbostic #if defined(LIBC_SCCS) && !defined(lint) 13*53794Sbostic static char sccsid[] = "@(#)cmpdi2.c 5.4 (Berkeley) 06/02/92"; 1453434Sbostic #endif /* LIBC_SCCS and not lint */ 1553434Sbostic 16*53794Sbostic #include "quad.h" 1753459Sbostic 18*53794Sbostic /* 19*53794Sbostic * Return 0, 1, or 2 as a <, =, > b respectively. 20*53794Sbostic * Both a and b are considered signed---which means only the high word is 21*53794Sbostic * signed. 22*53794Sbostic */ 23*53794Sbostic int 24*53794Sbostic __cmpdi2(quad a, quad b) 2553434Sbostic { 26*53794Sbostic union uu aa, bb; 2753434Sbostic 28*53794Sbostic aa.q = a; 29*53794Sbostic bb.q = b; 30*53794Sbostic return (aa.sl[H] < bb.sl[H] ? 0 : aa.sl[H] > bb.sl[H] ? 2 : 31*53794Sbostic aa.ul[L] < bb.ul[L] ? 0 : aa.ul[L] > bb.ul[L] ? 2 : 1); 3253434Sbostic } 33