xref: /csrg-svn/lib/libc/quad/negdi2.c (revision 54431)
153443Sbostic /*-
253443Sbostic  * Copyright (c) 1992 The Regents of the University of California.
353443Sbostic  * All rights reserved.
453443Sbostic  *
553794Sbostic  * This software was developed by the Computer Systems Engineering group
653794Sbostic  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
753794Sbostic  * contributed to Berkeley.
853794Sbostic  *
953443Sbostic  * %sccs.include.redist.c%
1053443Sbostic  */
1153443Sbostic 
1253443Sbostic #if defined(LIBC_SCCS) && !defined(lint)
13*54431Sbostic static char sccsid[] = "@(#)negdi2.c	5.5 (Berkeley) 06/25/92";
1453443Sbostic #endif /* LIBC_SCCS and not lint */
1553443Sbostic 
1653794Sbostic #include "quad.h"
1753459Sbostic 
1853794Sbostic /*
1953794Sbostic  * Return -a (or, equivalently, 0 - a), in quad.  See subdi3.c.
2053794Sbostic  */
21*54431Sbostic quad_t
22*54431Sbostic __negdi2(a)
23*54431Sbostic 	quad_t a;
2453443Sbostic {
2553794Sbostic 	union uu aa, res;
2653443Sbostic 
2753794Sbostic 	aa.q = a;
2853794Sbostic 	res.ul[L] = -aa.ul[L];
2953794Sbostic 	res.ul[H] = -aa.ul[H] - (res.ul[L] > 0);
3053794Sbostic 	return (res.q);
3153443Sbostic }
32