3 Provide intrinsics within Oniguruma
5 Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>
7 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License that accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/BaseMemoryLib.h>
19 // From CryptoPkg/IntrinsicLib
22 /* Copies bytes between buffers */
23 #pragma function(memcpy)
24 void * memcpy (void *dest
, const void *src
, unsigned int count
)
26 return CopyMem (dest
, src
, (UINTN
)count
);
29 /* Sets buffers to a specified character */
30 #pragma function(memset)
31 void * memset (void *dest
, char ch
, unsigned int count
)
34 // NOTE: Here we use one base implementation for memset, instead of the direct
35 // optimized SetMem() wrapper. Because the IntrinsicLib has to be built
36 // without whole program optimization option, and there will be some
37 // potential register usage errors when calling other optimized codes.
41 // Declare the local variables that actually move the data elements as
42 // volatile to prevent the optimizer from replacing this function with
43 // the intrinsic memset()
45 volatile UINT8
*Pointer
;
47 Pointer
= (UINT8
*)dest
;
48 while (count
-- != 0) {