Martin Roth | fb8876d | 2022-08-07 15:12:12 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 3 | #include <string.h> |
| 4 | |
| 5 | int 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 Leahy | 45fde70 | 2017-03-08 18:02:24 -0800 | [diff] [blame] | 12 | while ((bytes > 0) && (result == 0)) { |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 13 | result = *s1 - *s2; |
| 14 | bytes--; |
| 15 | s1++; |
| 16 | s2++; |
| 17 | } |
| 18 | return result; |
| 19 | } |