summaryrefslogtreecommitdiff
path: root/src/lib/memcmp.c
blob: a9690359b95a318e66ec0e635d8b7e920c76c472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* SPDX-License-Identifier: GPL-2.0-only */

#include <string.h>

int memcmp(const void *src1, const void *src2, size_t bytes)
{
	const unsigned char *s1, *s2;
	int result;
	s1 = src1;
	s2 = src2;
	result = 0;
	while ((bytes > 0) && (result == 0)) {
		result = *s1 - *s2;
		bytes--;
		s1++;
		s2++;
	}
	return result;
}