]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - ArmPkg/Library/CompilerIntrinsicsLib/memset.c
ArmPkg: Apply uncrustify changes
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / memset.c
... / ...
CommitLineData
1// ------------------------------------------------------------------------------\r
2//\r
3// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
4// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
5//\r
6// SPDX-License-Identifier: BSD-2-Clause-Patent\r
7//\r
8// ------------------------------------------------------------------------------\r
9\r
10typedef __SIZE_TYPE__ size_t;\r
11\r
12static __attribute__ ((__used__))\r
13void *\r
14__memset (\r
15 void *s,\r
16 int c,\r
17 size_t n\r
18 )\r
19{\r
20 unsigned char *d;\r
21\r
22 d = s;\r
23\r
24 while (n-- != 0) {\r
25 *d++ = c;\r
26 }\r
27\r
28 return s;\r
29}\r
30\r
31//\r
32// Other modules (such as CryptoPkg/IntrinsicLib) may provide another\r
33// implementation of memset(), which may conflict with this one if this\r
34// object was pulled into the link due to the definitions below. So make\r
35// our memset() 'weak' to let the other implementation take precedence.\r
36//\r
37__attribute__ ((__weak__, __alias__ ("__memset")))\r
38void *\r
39memset (\r
40 void *dest,\r
41 int c,\r
42 size_t n\r
43 );\r
44\r
45#ifdef __arm__\r
46\r
47void\r
48__aeabi_memset (\r
49 void *dest,\r
50 size_t n,\r
51 int c\r
52 )\r
53{\r
54 __memset (dest, c, n);\r
55}\r
56\r
57__attribute__ ((__alias__ ("__aeabi_memset")))\r
58void\r
59__aeabi_memset4 (\r
60 void *dest,\r
61 size_t n,\r
62 int c\r
63 );\r
64\r
65__attribute__ ((__alias__ ("__aeabi_memset")))\r
66void\r
67__aeabi_memset8 (\r
68 void *dest,\r
69 size_t n,\r
70 int c\r
71 );\r
72\r
73void\r
74__aeabi_memclr (\r
75 void *dest,\r
76 size_t n\r
77 )\r
78{\r
79 __memset (dest, 0, n);\r
80}\r
81\r
82__attribute__ ((__alias__ ("__aeabi_memclr")))\r
83void\r
84__aeabi_memclr4 (\r
85 void *dest,\r
86 size_t n\r
87 );\r
88\r
89__attribute__ ((__alias__ ("__aeabi_memclr")))\r
90void\r
91__aeabi_memclr8 (\r
92 void *dest,\r
93 size_t n\r
94 );\r
95\r
96#endif\r