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