/*- * Copyright (c) 1992 The Regents of the University of California. * All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * %sccs.include.redist.c% */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)adddi3.c 5.5 (Berkeley) 06/25/92"; #endif /* LIBC_SCCS and not lint */ #include "quad.h" /* * Add two quads. This is trivial since a one-bit carry from a single * u_long addition x+y occurs if and only if the sum x+y is less than * either x or y (the choice to compare with x or y is arbitrary). */ quad_t __adddi3(a, b) quad_t a, b; { union uu aa, bb, sum; aa.q = a; bb.q = b; sum.ul[L] = aa.ul[L] + bb.ul[L]; sum.ul[H] = aa.ul[H] + bb.ul[H] + (sum.ul[L] < bb.ul[L]); return (sum.q); }