148760Sbostic/*- 2*62365Sbostic * Copyright (c) 1988, 1993 3*62365Sbostic * The Regents of the University of California. All rights reserved. 430026Sminshall * 548760Sbostic * %sccs.include.redist.c% 633815Sbostic * 7*62365Sbostic * @(#)vaxbsubs.s 8.1 (Berkeley) 06/06/93 830026Sminshall */ 930026Sminshall 1030026Sminshall/* This is taken from bcmp.s from 4.2. 1130026Sminshall * The output of bunequal is the offset of the byte which didn't match; 1230026Sminshall * if all the bytes match, then we return n. 1330026Sminshall * 1430026Sminshall * BUGNOTE: This has no chance of working for lengths greater than 64K. 1530026Sminshall * (so, if you use this somewhere else, you may need to 1630026Sminshall * fix it...) 1730026Sminshall */ 1830026Sminshall 1930026Sminshall/* bunequal(s1, s2, n) */ 2030026Sminshall 2130026Sminshall#include "defs.h" 2230026Sminshall 2330026SminshallENTRY(bunequal) 2430026Sminshall movl 4(ap),r1 2530026Sminshall movl 8(ap),r3 2630026Sminshall movl 12(ap),r4 2730026Sminshall1: 2830026Sminshall movzwl $65535,r0 2930026Sminshall cmpl r4,r0 3030026Sminshall jleq 2f 3130026Sminshall subl2 r0,r4 3230026Sminshall cmpc3 r0,(r1),(r3) 3330026Sminshall jeql 1b 3430026Sminshall addl2 r4,r0 3530026Sminshall /* changes... */ 3630026Sminshall subl3 r0,12(ap),r0 3730026Sminshall /* end of changes for bunequal... */ 3830026Sminshall ret 3930026Sminshall2: 4030026Sminshall cmpc3 r4,(r1),(r3) 4130026Sminshall /* changes... */ 4230026Sminshall subl3 r0,12(ap),r0 4330026Sminshall /* end of changes for bunequal... */ 4430026Sminshall ret 4530026Sminshall 4630026Sminshall 4730026Sminshall 4830026Sminshall 4930026Sminshall/* brand new code, using the above as base... */ 5030026Sminshall/* bskip(s1, n, b) : finds the first occurrence of any byte != 'b' in the 'n' 5130026Sminshall * bytes beginning at 's1'. 5230026Sminshall * 5330026Sminshall * BUGNOTE: This has no chance of working for lengths greater than 64K. 5430026Sminshall * (so, if you use this somewhere else, you may need to 5530026Sminshall * fix it...) 5630026Sminshall */ 5730026Sminshall 5830026SminshallENTRY(bskip) 5930026Sminshall movl 4(ap),r1 6030026Sminshall movl 8(ap),r3 6130026Sminshall movl 12(ap),r4 6230026Sminshall1: 6330026Sminshall movzwl $65535,r0 6430026Sminshall cmpl r3,r0 6530026Sminshall jleq 2f 6630026Sminshall subl2 r0,r3 6730026Sminshall skpc r4,r0,(r1) 6830026Sminshall jeql 1b 6930026Sminshall addl2 r3,r0 7030026Sminshall subl3 r0,8(ap),r0 7130026Sminshall ret 7230026Sminshall2: 7330026Sminshall skpc r4,r3,(r1) 7430026Sminshall subl3 r0,8(ap),r0 7530026Sminshall ret 76