xref: /original-bsd/lib/libc/quad/negdi2.c (revision d45fc766)
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[] = "@(#)negdi2.c	8.1 (Berkeley) 06/04/93";
14 #endif /* LIBC_SCCS and not lint */
15 
16 #include "quad.h"
17 
18 /*
19  * Return -a (or, equivalently, 0 - a), in quad.  See subdi3.c.
20  */
21 quad_t
22 __negdi2(a)
23 	quad_t a;
24 {
25 	union uu aa, res;
26 
27 	aa.q = a;
28 	res.ul[L] = -aa.ul[L];
29 	res.ul[H] = -aa.ul[H] - (res.ul[L] > 0);
30 	return (res.q);
31 }
32