1/*-
2 * Copyright (c) 1988, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
7 *	@(#)vaxbsubs.s	8.1 (Berkeley) 06/06/93
8 */
9
10/* This is taken from bcmp.s from 4.2.
11 * The output of bunequal is the offset of the byte which didn't match;
12 * if all the bytes match, then we return n.
13 *
14 * BUGNOTE:  This has no chance of working for lengths greater than 64K.
15 *		(so, if you use this somewhere else, you may need to
16 *		fix it...)
17 */
18
19/* bunequal(s1, s2, n) */
20
21#include "defs.h"
22
23ENTRY(bunequal)
24	movl	4(ap),r1
25	movl	8(ap),r3
26	movl	12(ap),r4
271:
28	movzwl	$65535,r0
29	cmpl	r4,r0
30	jleq	2f
31	subl2	r0,r4
32	cmpc3	r0,(r1),(r3)
33	jeql	1b
34	addl2	r4,r0
35	/* changes... */
36	subl3	r0,12(ap),r0
37	/* end of changes for bunequal... */
38	ret
392:
40	cmpc3	r4,(r1),(r3)
41	/* changes... */
42	subl3	r0,12(ap),r0
43	/* end of changes for bunequal... */
44	ret
45
46
47
48
49/* brand new code, using the above as base... */
50/* bskip(s1, n, b) : finds the first occurrence of any byte != 'b' in the 'n'
51 * bytes beginning at 's1'.
52 *
53 * BUGNOTE:  This has no chance of working for lengths greater than 64K.
54 *		(so, if you use this somewhere else, you may need to
55 *		fix it...)
56 */
57
58ENTRY(bskip)
59	movl	4(ap),r1
60	movl	8(ap),r3
61	movl	12(ap),r4
621:
63	movzwl	$65535,r0
64	cmpl	r3,r0
65	jleq	2f
66	subl2	r0,r3
67	skpc	r4,r0,(r1)
68	jeql	1b
69	addl2	r3,r0
70	subl3	r0,8(ap),r0
71	ret
722:
73	skpc	r4,r3,(r1)
74	subl3	r0,8(ap),r0
75	ret
76