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