|
|
1.1 root 1: /*
2: * Copyright 1984, 1985 by the Regents of the University of
3: * California and by Gregory Glenn Minshall.
4: *
5: * Permission to use, copy, modify, and distribute these
6: * programs and their documentation for any purpose and
7: * without fee is hereby granted, provided that this
8: * copyright and permission appear on all copies and
9: * supporting documentation, the name of the Regents of
10: * the University of California not be used in advertising
11: * or publicity pertaining to distribution of the programs
12: * without specific prior permission, and notice be given in
13: * supporting documentation that copying and distribution is
14: * by permission of the Regents of the University of California
15: * and by Gregory Glenn Minshall. Neither the Regents of the
16: * University of California nor Gregory Glenn Minshall make
17: * representations about the suitability of this software
18: * for any purpose. It is provided "as is" without
19: * express or implied warranty.
20: */
21:
22: /* This is taken from bcmp.s from 4.2.
23: * The output of bunequal is the offset of the byte which didn't match;
24: * if all the bytes match, then we return n.
25: *
26: * BUGNOTE: This has no chance of working for lengths greater than 64K.
27: * (so, if you use this somewhere else, you may need to
28: * fix it...)
29: */
30: /* @(#)vaxbsubs.s 1.2 1.2 */
31: /* bunequal(s1, s2, n) */
32:
33: #include "DEFS.h"
34:
35: ENTRY(bunequal)
36: movl 4(ap),r1
37: movl 8(ap),r3
38: movl 12(ap),r4
39: 1:
40: movzwl $65535,r0
41: cmpl r4,r0
42: jleq 2f
43: subl2 r0,r4
44: cmpc3 r0,(r1),(r3)
45: jeql 1b
46: addl2 r4,r0
47: /* changes... */
48: subl3 r0,12(ap),r0
49: /* end of changes for bunequal... */
50: ret
51: 2:
52: cmpc3 r4,(r1),(r3)
53: /* changes... */
54: subl3 r0,12(ap),r0
55: /* end of changes for bunequal... */
56: ret
57:
58:
59:
60:
61: /* brand new code, using the above as base... */
62: /* bskip(s1, n, b) : finds the first occurrence of any byte != 'b' in the 'n'
63: * bytes beginning at 's1'.
64: *
65: * BUGNOTE: This has no chance of working for lengths greater than 64K.
66: * (so, if you use this somewhere else, you may need to
67: * fix it...)
68: */
69:
70: ENTRY(bskip)
71: movl 4(ap),r1
72: movl 8(ap),r3
73: movl 12(ap),r4
74: 1:
75: movzwl $65535,r0
76: cmpl r3,r0
77: jleq 2f
78: subl2 r0,r3
79: skpc r4,r0,(r1)
80: jeql 1b
81: addl2 r3,r0
82: subl3 r0,8(ap),r0
83: ret
84: 2:
85: skpc r4,r3,(r1)
86: subl3 r0,8(ap),r0
87: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.