1: /*
2: * Program: ulsh.s
3: * Copyright 1993, GTE Government Systems
4: * Author: Steven M. Schultz
5: *
6: * Version Date Modification
7: * 0.0 02Feb91 1. Initial inspiration struck.
8: * 1.0 05Jun93 2. Released into the Public Domain.
9: */
10:
11: #include "DEFS.h"
12:
13: /*
14: * All routines have both a C interface and an assembly interface. Normally
15: * the two are the same. In the case of 'ulsh' the compiler has placed one
16: * of the operands in r0 and r1 so the assembly interface differs from the
17: * C interface.
18: */
19:
20: /*
21: * u_long ulsh(lhs, count)
22: * u_long lhs;
23: * short count;
24: *
25: * 32-bit "<<" and ">>" routines. Calls to ulsh are generated
26: * automatically by the C compiler.
27: */
28:
29: ASENTRY(ulsh)
30: tst 2(sp) / shift count is on stack, long is in r0+r1
31: bpl 1f
32: ror r0
33: ror r1
34: inc 2(sp)
35: 1:
36: ashc 2(sp),r0
37: rts pc
38:
39: ENTRY(ulsh)
40: mov 2(sp),r0
41: mov 4(sp),r1
42: tst 6(sp) / positive count?
43: bpl 1f / yes - br
44: ror r0 / do the first shift
45: ror r1 / the hard way
46: inc 6(sp) / bump count towards zero
47: 1:
48: ashc 6(sp),r0 / do the rest of the shifting
49: rts pc
50:
51: /*
52: * u_long ualsh(lhs, count)
53: * u_long *lhs;
54: * short count;
55: *
56: * 32-bit "<<=" and ">>=" routines. Calls to ualsh are generated
57: * automatically by the C compiler.
58: */
59: .globl ualsh
60: ualsh:
61: ENTRY(ualsh)
62: mov r2,-(sp) / save a register
63: mov 4(sp),r2 / *lhs
64: mov (r2)+,r0
65: mov (r2)+,r1
66: tst 6(sp) / positive count?
67: bpl 1f / yes - br
68: ror r0 / do the first shift
69: ror r1 / the hard way
70: inc 6(sp) / bump count towards zero
71: 1:
72: ashc 6(sp),r0 / do the rest of the shifting
73: mov r1,-(r2)
74: mov r0,-(r2)
75: mov (sp)+,r2
76: rts pc
Defined functions
_ulsh
defined in line
39;
never used
ualsh
declared in line
59; defined in line
60; used 1 times
ulsh
defined in line
29;
never used