Antonio Nino Diaz | 9eddb1e | 2018-08-16 14:53:05 +0100 | [diff] [blame] | 1 | /* |
2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. | ||||
3 | * | ||||
4 | * SPDX-License-Identifier: BSD-3-Clause | ||||
5 | */ | ||||
6 | |||||
7 | #include <stddef.h> | ||||
8 | |||||
9 | int memcmp(const void *s1, const void *s2, size_t len) | ||||
10 | { | ||||
11 | const unsigned char *s = s1; | ||||
12 | const unsigned char *d = s2; | ||||
13 | unsigned char sc; | ||||
14 | unsigned char dc; | ||||
15 | |||||
16 | while (len--) { | ||||
17 | sc = *s++; | ||||
18 | dc = *d++; | ||||
19 | if (sc - dc) | ||||
20 | return (sc - dc); | ||||
21 | } | ||||
22 | |||||
23 | return 0; | ||||
24 | } |