153431Sbostic /*- 2*61153Sbostic * Copyright (c) 1992, 1993 3*61153Sbostic * The Regents of the University of California. All rights reserved. 453431Sbostic * 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 * 953431Sbostic * %sccs.include.redist.c% 1053431Sbostic */ 1153431Sbostic 1253431Sbostic #if defined(LIBC_SCCS) && !defined(lint) 13*61153Sbostic static char sccsid[] = "@(#)adddi3.c 8.1 (Berkeley) 06/04/93"; 1453431Sbostic #endif /* LIBC_SCCS and not lint */ 1553431Sbostic 1653794Sbostic #include "quad.h" 1753459Sbostic 1853794Sbostic /* 1953794Sbostic * Add two quads. This is trivial since a one-bit carry from a single 2053794Sbostic * u_long addition x+y occurs if and only if the sum x+y is less than 2153794Sbostic * either x or y (the choice to compare with x or y is arbitrary). 2253794Sbostic */ 2354431Sbostic quad_t __adddi3(a,b)2454431Sbostic__adddi3(a, b) 2554431Sbostic quad_t a, b; 2653431Sbostic { 2753794Sbostic union uu aa, bb, sum; 2853431Sbostic 2953794Sbostic aa.q = a; 3053794Sbostic bb.q = b; 3153794Sbostic sum.ul[L] = aa.ul[L] + bb.ul[L]; 3253794Sbostic sum.ul[H] = aa.ul[H] + bb.ul[H] + (sum.ul[L] < bb.ul[L]); 3353794Sbostic return (sum.q); 3453431Sbostic } 35