1 /*- 2 * Copyright (c) 1992 The Regents of the University of California. 3 * 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[] = "@(#)adddi3.c 5.4 (Berkeley) 06/02/92"; 14 #endif /* LIBC_SCCS and not lint */ 15 16 #include "quad.h" 17 18 /* 19 * Add two quads. This is trivial since a one-bit carry from a single 20 * u_long addition x+y occurs if and only if the sum x+y is less than 21 * either x or y (the choice to compare with x or y is arbitrary). 22 */ 23 quad 24 __adddi3(quad a, quad b) 25 { 26 union uu aa, bb, sum; 27 28 aa.q = a; 29 bb.q = b; 30 sum.ul[L] = aa.ul[L] + bb.ul[L]; 31 sum.ul[H] = aa.ul[H] + bb.ul[H] + (sum.ul[L] < bb.ul[L]); 32 return (sum.q); 33 } 34