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 * This code is derived from software contributed to Berkeley by 8 * Computer Consoles Inc. 9 */ 10 11#if defined(LIBC_SCCS) && !defined(lint) 12 .asciz "@(#)memcmp.s 8.1 (Berkeley) 06/04/93" 13#endif /* LIBC_SCCS and not lint */ 14 15/* 16 * int 17 * memcmp(s1, s2, n) 18 * void const *s1, const *s2; 19 * size_t n; 20 * 21 * Compare up to n bytes from s1/s2. 22 * Return 23 * = 0 if s1 == s2 24 * < 0 if s1 < s2 (unsigned character comparison) 25 * > 0 if s1 > s2 26 */ 27#include "DEFS.h" 28 29ENTRY(memcmp, 0) 30 movl 4(fp),r0 31 movl 8(fp),r1 32 mnegl 12(fp),r2 33 jeql 2f 341: 35 cmpb (r0),(r1) 36 jneq 3f 37 incl r0 38 incl r1 39 aoblss $0,r2,1b 402: 41 clrl r0 42 ret 433: 44 jlssu 4f 45 movl $1,r0 46 ret 474: 48 mnegl $1,r0 49 ret 50