1231437Sluigi/* $NetBSD: ucmpdi2.c,v 1.1 2005/12/20 19:28:51 christos Exp $ */ 2252869Sdelphij 3231437Sluigi/*- 4231437Sluigi * Copyright (c) 1992, 1993 5231437Sluigi * The Regents of the University of California. All rights reserved. 6231437Sluigi * 7231437Sluigi * This software was developed by the Computer Systems Engineering group 8231437Sluigi * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 9231437Sluigi * contributed to Berkeley. 10231437Sluigi * 11231437Sluigi * Redistribution and use in source and binary forms, with or without 12231437Sluigi * modification, are permitted provided that the following conditions 13231437Sluigi * are met: 14231437Sluigi * 1. Redistributions of source code must retain the above copyright 15231437Sluigi * notice, this list of conditions and the following disclaimer. 16231437Sluigi * 2. Redistributions in binary form must reproduce the above copyright 17231437Sluigi * notice, this list of conditions and the following disclaimer in the 18231437Sluigi * documentation and/or other materials provided with the distribution. 19231437Sluigi * 3. Neither the name of the University nor the names of its contributors 20231437Sluigi * may be used to endorse or promote products derived from this software 21231437Sluigi * without specific prior written permission. 22231437Sluigi * 23231437Sluigi * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24231437Sluigi * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25231437Sluigi * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26231437Sluigi * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27231437Sluigi * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28231437Sluigi * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29231437Sluigi * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30231437Sluigi * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31231437Sluigi * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32231437Sluigi * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33231437Sluigi * SUCH DAMAGE. 34231437Sluigi */ 35231437Sluigi 36231437Sluigi#include <sys/cdefs.h> 37231437Sluigi#if defined(LIBC_SCCS) && !defined(lint) 38231437Sluigi#if 0 39231437Sluigistatic char sccsid[] = "@(#)ucmpdi2.c 8.1 (Berkeley) 6/4/93"; 40231437Sluigi#else 41231437Sluigi__RCSID("$NetBSD: ucmpdi2.c,v 1.1 2005/12/20 19:28:51 christos Exp $"); 42231437Sluigi#endif 43231437Sluigi#endif /* LIBC_SCCS and not lint */ 44231437Sluigi 45231437Sluigi#include "quad.h" 46231437Sluigi 47231437Sluigi/* 48231437Sluigi * Return 0, 1, or 2 as a <, =, > b respectively. 49231437Sluigi * Neither a nor b are considered signed. 50231437Sluigi */ 51231437Sluigiint 52231437Sluigi__ucmpdi2(u_quad_t a, u_quad_t b) 53231437Sluigi{ 54231437Sluigi union uu aa, bb; 55231437Sluigi 56231437Sluigi aa.uq = a; 57231437Sluigi bb.uq = b; 58231437Sluigi return (aa.ul[H] < bb.ul[H] ? 0 : aa.ul[H] > bb.ul[H] ? 2 : 59231437Sluigi aa.ul[L] < bb.ul[L] ? 0 : aa.ul[L] > bb.ul[L] ? 2 : 1); 60231437Sluigi} 61231437Sluigi