]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/CompilerIntrinsicsLib/memset.c
3d417d797242d9a168a71ca565f8d6ce1e02cd90
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / memset.c
1 //------------------------------------------------------------------------------
2 //
3 // Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
4 //
5 // This program and the accompanying materials are licensed and made
6 // available under the terms and conditions of the BSD License which
7 // accompanies this distribution. The full text of the license may be
8 // found at http://opensource.org/licenses/bsd-license.php
9 //
10 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
12 // IMPLIED.
13 //
14 //------------------------------------------------------------------------------
15
16 typedef __SIZE_TYPE__ size_t;
17
18 static __attribute__((__used__))
19 void *__memset(void *s, int c, size_t n)
20 {
21 unsigned char *d = s;
22
23 while (n--)
24 *d++ = c;
25
26 return s;
27 }
28
29 __attribute__((__alias__("__memset")))
30 void *memset(void *dest, int c, size_t n);
31
32 #ifdef __arm__
33
34 void __aeabi_memset(void *dest, size_t n, int c)
35 {
36 __memset(dest, c, n);
37 }
38
39 __attribute__((__alias__("__aeabi_memset")))
40 void __aeabi_memset4(void *dest, size_t n, int c);
41
42 __attribute__((__alias__("__aeabi_memset")))
43 void __aeabi_memset8(void *dest, size_t n, int c);
44
45 void __aeabi_memclr(void *dest, size_t n)
46 {
47 __memset(dest, 0, n);
48 }
49
50 __attribute__((__alias__("__aeabi_memclr")))
51 void __aeabi_memclr4(void *dest, size_t n);
52
53 __attribute__((__alias__("__aeabi_memclr")))
54 void __aeabi_memclr8(void *dest, size_t n);
55
56 #endif