xref: /csrg-svn/lib/libc/quad/negdi2.c (revision 53794)
153443Sbostic /*-
253443Sbostic  * Copyright (c) 1992 The Regents of the University of California.
353443Sbostic  * All rights reserved.
453443Sbostic  *
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  *
953443Sbostic  * %sccs.include.redist.c%
1053443Sbostic  */
1153443Sbostic 
1253443Sbostic #if defined(LIBC_SCCS) && !defined(lint)
13*53794Sbostic static char sccsid[] = "@(#)negdi2.c	5.4 (Berkeley) 06/02/92";
1453443Sbostic #endif /* LIBC_SCCS and not lint */
1553443Sbostic 
16*53794Sbostic #include "quad.h"
1753459Sbostic 
18*53794Sbostic /*
19*53794Sbostic  * Return -a (or, equivalently, 0 - a), in quad.  See subdi3.c.
20*53794Sbostic  */
21*53794Sbostic quad
22*53794Sbostic __negdi2(quad a)
2353443Sbostic {
24*53794Sbostic 	union uu aa, res;
2553443Sbostic 
26*53794Sbostic 	aa.q = a;
27*53794Sbostic 	res.ul[L] = -aa.ul[L];
28*53794Sbostic 	res.ul[H] = -aa.ul[H] - (res.ul[L] > 0);
29*53794Sbostic 	return (res.q);
3053443Sbostic }
31