Annotation of 43BSDTahoe/ucb/tn3270/general/vaxbsubs.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that this notice is preserved and that due credit is given
                      7:  * to the University of California at Berkeley. The name of the University
                      8:  * may not be used to endorse or promote products derived from this
                      9:  * software without specific prior written permission. This software
                     10:  * is provided ``as is'' without express or implied warranty.
                     11:  *
                     12:  *     @(#)vaxbsubs.s  1.2 (Berkeley) 3/28/88
                     13:  */
                     14: 
                     15: /* This is taken from bcmp.s from 4.2.
                     16:  * The output of bunequal is the offset of the byte which didn't match;
                     17:  * if all the bytes match, then we return n.
                     18:  *
                     19:  * BUGNOTE:  This has no chance of working for lengths greater than 64K.
                     20:  *             (so, if you use this somewhere else, you may need to
                     21:  *             fix it...)
                     22:  */
                     23: 
                     24: /* bunequal(s1, s2, n) */
                     25: 
                     26: #include "defs.h"
                     27: 
                     28: ENTRY(bunequal)
                     29:        movl    4(ap),r1
                     30:        movl    8(ap),r3
                     31:        movl    12(ap),r4
                     32: 1:
                     33:        movzwl  $65535,r0
                     34:        cmpl    r4,r0
                     35:        jleq    2f
                     36:        subl2   r0,r4
                     37:        cmpc3   r0,(r1),(r3)
                     38:        jeql    1b
                     39:        addl2   r4,r0
                     40:        /* changes... */
                     41:        subl3   r0,12(ap),r0
                     42:        /* end of changes for bunequal... */
                     43:        ret
                     44: 2:
                     45:        cmpc3   r4,(r1),(r3)
                     46:        /* changes... */
                     47:        subl3   r0,12(ap),r0
                     48:        /* end of changes for bunequal... */
                     49:        ret
                     50: 
                     51: 
                     52: 
                     53: 
                     54: /* brand new code, using the above as base... */
                     55: /* bskip(s1, n, b) : finds the first occurrence of any byte != 'b' in the 'n'
                     56:  * bytes beginning at 's1'.
                     57:  *
                     58:  * BUGNOTE:  This has no chance of working for lengths greater than 64K.
                     59:  *             (so, if you use this somewhere else, you may need to
                     60:  *             fix it...)
                     61:  */
                     62: 
                     63: ENTRY(bskip)
                     64:        movl    4(ap),r1
                     65:        movl    8(ap),r3
                     66:        movl    12(ap),r4
                     67: 1:
                     68:        movzwl  $65535,r0
                     69:        cmpl    r3,r0
                     70:        jleq    2f
                     71:        subl2   r0,r3
                     72:        skpc    r4,r0,(r1)
                     73:        jeql    1b
                     74:        addl2   r3,r0
                     75:        subl3   r0,8(ap),r0
                     76:        ret
                     77: 2:
                     78:        skpc    r4,r3,(r1)
                     79:        subl3   r0,8(ap),r0
                     80:        ret

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.