Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1627 serge 1
/*	bcmp()						Author: Kees J. Bot */
2
/*								2 Jan 1994 */
3
 
4
/* int bcmp(const void *s1, const void *s2, size_t n) */
5
/*	Compare two chunks of memory. */
6
/*	This is a BSD routine that escaped from the kernel.  Don't use. */
7
/*	(Alas it is not without some use, it reports the number of bytes */
8
/*	after the bytes that are equal.  So it can't be simply replaced.) */
9
/* */
10
#include "asm.h"
11
 
12
ENTRY(bcmp)
13
	push	%ebp
14
	movl	%esp, %ebp
15
	push	16(%ebp)
16
	push	12(%ebp)
17
	push	8(%ebp)
18
	call	_C_LABEL(memcmp) /* Let memcmp do the work */
19
	testl	%eax, %eax
20
	je	equal
21
	subl	8(%ebp), %edx	/* Memcmp was nice enough to leave "esi" in edx */
22
	decl	%edx	/* Number of bytes that are equal */
23
	movl	16(%ebp), %eax
24
	subl	%edx, %eax	/* Number of bytes that are unequal */
25
equal:
26
	leave
27
	ret