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