|
|
1.1 root 1:
2: /*
3: * strcmpn.s 4.1 (Tahoe) June 1983
4: *
5: * Compare strings (at most n bytes): s1>s2: >0 s1==s2: 0 s1<s2: <0
6: *
7: * strcmpn(s1, s2, n)
8: * register char *s1, *s2;
9: * register n;
10: */
11:
12: .text
13: .align 1
14: .globl _strcmpn
15:
16: _strcmpn: .word 4 /* saves r2 */
17: movl 12(fp),r2
18: tstl r2 /* number of bytes to compare */
19: jgtr n_ok
20: clrl r0
21: ret /* for n <= 0 , s1 == s2 */
22: n_ok:
23: movl 4(fp),r0
24: movl 8(fp),r1
25: cmps3
26: jgtr greater
27: jlss less
28: equal: clrl r0
29: ret
30: less: movl $-1,r0
31: ret
32: greater: movl $1,r0
33: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.