153441Sbostic /*- 2*61160Sbostic * Copyright (c) 1992, 1993 3*61160Sbostic * The Regents of the University of California. All rights reserved. 453441Sbostic * 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 * 953441Sbostic * %sccs.include.redist.c% 1053441Sbostic */ 1153441Sbostic 1253441Sbostic #if defined(LIBC_SCCS) && !defined(lint) 13*61160Sbostic static char sccsid[] = "@(#)lshrdi3.c 8.1 (Berkeley) 06/04/93"; 1453441Sbostic #endif /* LIBC_SCCS and not lint */ 1553441Sbostic 1653794Sbostic #include "quad.h" 1753459Sbostic 1853794Sbostic /* 1953794Sbostic * Shift an (unsigned) quad value right (logical shift right). 2053794Sbostic */ 2154431Sbostic quad_t __lshrdi3(a,shift)2254431Sbostic__lshrdi3(a, shift) 2354431Sbostic quad_t a; 2454431Sbostic qshift_t shift; 2553441Sbostic { 2653794Sbostic union uu aa; 2753441Sbostic 2853794Sbostic aa.q = a; 2953794Sbostic if (shift >= LONG_BITS) { 3053794Sbostic aa.ul[L] = shift >= QUAD_BITS ? 0 : 3153794Sbostic aa.ul[H] >> (shift - LONG_BITS); 3253794Sbostic aa.ul[H] = 0; 3353794Sbostic } else if (shift > 0) { 3453794Sbostic aa.ul[L] = (aa.ul[L] >> shift) | 3553794Sbostic (aa.ul[H] << (LONG_BITS - shift)); 3653794Sbostic aa.ul[H] >>= shift; 3753794Sbostic } 3853794Sbostic return (aa.q); 3953441Sbostic } 40