]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaIntrinsics.c
MdeModulePkg: Delete useless case code
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / OnigurumaIntrinsics.c
CommitLineData
14b0e578
CS
1/** @file\r
2\r
3 Provide intrinsics within Oniguruma\r
4\r
0af8e57c 5 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
14b0e578
CS
6\r
7 This program and the accompanying materials are licensed and made available\r
8 under the terms and conditions of the BSD License that accompanies this\r
9 distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14**/\r
15\r
16#include <Library/BaseMemoryLib.h>\r
17\r
18//\r
19// From CryptoPkg/IntrinsicLib\r
20//\r
21\r
22/* Copies bytes between buffers */\r
23#pragma function(memcpy)\r
24void * memcpy (void *dest, const void *src, unsigned int count)\r
25{\r
26 return CopyMem (dest, src, (UINTN)count);\r
27}\r
28\r
29/* Sets buffers to a specified character */\r
30#pragma function(memset)\r
31void * memset (void *dest, char ch, unsigned int count)\r
32{\r
33 //\r
34 // NOTE: Here we use one base implementation for memset, instead of the direct\r
35 // optimized SetMem() wrapper. Because the IntrinsicLib has to be built\r
36 // without whole program optimization option, and there will be some\r
37 // potential register usage errors when calling other optimized codes.\r
38 //\r
39\r
40 //\r
41 // Declare the local variables that actually move the data elements as\r
42 // volatile to prevent the optimizer from replacing this function with\r
43 // the intrinsic memset()\r
44 //\r
45 volatile UINT8 *Pointer;\r
46\r
47 Pointer = (UINT8 *)dest;\r
48 while (count-- != 0) {\r
49 *(Pointer++) = ch;\r
50 }\r
51\r
52 return dest;\r
53}\r