TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
crt_memcmp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 
11 int memcmp(const void *s1, const void *s2, size_t n)
12 {
13  int result = 0;
14  const uint8_t *p1 = (const uint8_t *)s1;
15  const uint8_t *p2 = (const uint8_t *)s2;
16  while (n--) {
17  if ((*p1 != *p2) && (result == 0)) {
18  result = *p1 - *p2;
19  } else {
20  p1++;
21  p2++;
22  }
23  }
24  return result;
25 }
int memcmp(const void *s1, const void *s2, size_t n)
Definition: crt_memcmp.c:11