blob: a9690359b95a318e66ec0e635d8b7e920c76c472 [file] [log] [blame]
Martin Rothfb8876d2022-08-07 15:12:12 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
Eric Biederman8ca8d762003-04-22 19:02:15 +00003#include <string.h>
4
5int memcmp(const void *src1, const void *src2, size_t bytes)
6{
7 const unsigned char *s1, *s2;
8 int result;
9 s1 = src1;
10 s2 = src2;
11 result = 0;
Lee Leahy45fde702017-03-08 18:02:24 -080012 while ((bytes > 0) && (result == 0)) {
Eric Biederman8ca8d762003-04-22 19:02:15 +000013 result = *s1 - *s2;
14 bytes--;
15 s1++;
16 s2++;
17 }
18 return result;
19}