1*53441Sbostic /*- 2*53441Sbostic * Copyright (c) 1992 The Regents of the University of California. 3*53441Sbostic * All rights reserved. 4*53441Sbostic * 5*53441Sbostic * %sccs.include.redist.c% 6*53441Sbostic */ 7*53441Sbostic 8*53441Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*53441Sbostic static char sccsid[] = "@(#)lshrdi3.c 5.1 (Berkeley) 05/12/92"; 10*53441Sbostic #endif /* LIBC_SCCS and not lint */ 11*53441Sbostic 12*53441Sbostic #include "longlong.h" 13*53441Sbostic 14*53441Sbostic long long 15*53441Sbostic __lshrdi3 (u, b1) 16*53441Sbostic long long u; 17*53441Sbostic long long b1; 18*53441Sbostic { 19*53441Sbostic long_long w; 20*53441Sbostic unsigned long carries; 21*53441Sbostic int bm; 22*53441Sbostic long_long uu; 23*53441Sbostic int b = b1; 24*53441Sbostic 25*53441Sbostic if (b == 0) 26*53441Sbostic return u; 27*53441Sbostic 28*53441Sbostic uu.ll = u; 29*53441Sbostic 30*53441Sbostic bm = (sizeof (int) * BITS_PER_UNIT) - b; 31*53441Sbostic if (bm <= 0) 32*53441Sbostic { 33*53441Sbostic w.s.high = 0; 34*53441Sbostic w.s.low = (unsigned long)uu.s.high >> -bm; 35*53441Sbostic } 36*53441Sbostic else 37*53441Sbostic { 38*53441Sbostic carries = (unsigned long)uu.s.high << bm; 39*53441Sbostic w.s.high = (unsigned long)uu.s.high >> b; 40*53441Sbostic w.s.low = ((unsigned long)uu.s.low >> b) | carries; 41*53441Sbostic } 42*53441Sbostic 43*53441Sbostic return w.ll; 44*53441Sbostic } 45