153440Sbostic /*- 253440Sbostic * Copyright (c) 1992 The Regents of the University of California. 353440Sbostic * All rights reserved. 453440Sbostic * 553440Sbostic * %sccs.include.redist.c% 653440Sbostic */ 753440Sbostic 853440Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*53452Sbostic static char sccsid[] = "@(#)lshldi3.c 5.2 (Berkeley) 05/12/92"; 1053440Sbostic #endif /* LIBC_SCCS and not lint */ 1153440Sbostic 1253440Sbostic #include "longlong.h" 1353440Sbostic 1453440Sbostic long long 1553440Sbostic __lshldi3 (u, b1) 1653440Sbostic long long u; 1753440Sbostic long long b1; 1853440Sbostic { 1953440Sbostic long_long w; 2053440Sbostic unsigned long carries; 2153440Sbostic int bm; 2253440Sbostic long_long uu; 2353440Sbostic int b = b1; 2453440Sbostic 2553440Sbostic if (b == 0) 2653440Sbostic return u; 2753440Sbostic 2853440Sbostic uu.ll = u; 2953440Sbostic 30*53452Sbostic bm = (sizeof (int) * NBBY) - b; 3153440Sbostic if (bm <= 0) 3253440Sbostic { 3353440Sbostic w.s.low = 0; 3453440Sbostic w.s.high = (unsigned long)uu.s.low << -bm; 3553440Sbostic } 3653440Sbostic else 3753440Sbostic { 3853440Sbostic carries = (unsigned long)uu.s.low >> bm; 3953440Sbostic w.s.low = (unsigned long)uu.s.low << b; 4053440Sbostic w.s.high = ((unsigned long)uu.s.high << b) | carries; 4153440Sbostic } 4253440Sbostic 4353440Sbostic return w.ll; 4453440Sbostic } 45