TianoCore EDK2 master
Loading...
Searching...
No Matches
memcmp_ms.c
1// ------------------------------------------------------------------------------
2//
3// Copyright (c) 2019, Pete Batard. All rights reserved.
4// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
5//
6// SPDX-License-Identifier: BSD-2-Clause-Patent
7//
8// ------------------------------------------------------------------------------
9
10#if defined (_M_ARM64)
11typedef unsigned __int64 size_t;
12#else
13typedef unsigned __int32 size_t;
14#endif
15
16int
17memcmp (
18 void *,
19 void *,
20 size_t
21 );
22
23#pragma intrinsic(memcmp)
24#pragma function(memcmp)
25int
26memcmp (
27 const void *s1,
28 const void *s2,
29 size_t n
30 )
31{
32 unsigned char const *t1;
33 unsigned char const *t2;
34
35 t1 = s1;
36 t2 = s2;
37
38 while (n-- != 0) {
39 if (*t1 != *t2) {
40 return (int)*t1 - (int)*t2;
41 }
42
43 t1++;
44 t2++;
45 }
46
47 return 0;
48}