]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/CopyMem.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseMemoryLib / Ipf / CopyMem.c
CommitLineData
3eb9473e 1/*++\r
2\r
2c7e5c2f
HT
3Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 CopyMem.c\r
16 \r
17Abstract: \r
18\r
19 Internal CopyMem\r
20\r
21--*/\r
22\r
23#include "BaseMemoryLibInternal.h"\r
24\r
25/**\r
26 Copy Length bytes from Source to Destination.\r
27\r
28 @param Destination Target of copy\r
29 @param Source Place to copy from\r
30 @param Length Number of bytes to copy\r
31\r
32 @return Destination\r
33\r
34**/\r
35VOID *\r
36EFIAPI\r
37InternalMemCopyMem (\r
38 OUT VOID *Destination,\r
39 IN CONST VOID *Source,\r
40 IN UINTN Length\r
41 )\r
42{\r
43 //\r
44 // Declare the local variables that actually move the data elements as\r
45 // volatile to prevent the optimizer from replacing this function with\r
46 // the intrinsic memcpy()\r
47 //\r
48 volatile UINT8 *Destination8;\r
49 CONST UINT8 *Source8;\r
50\r
51 if (Source > Destination) {\r
52 Destination8 = (UINT8*)Destination;\r
53 Source8 = (CONST UINT8*)Source;\r
54 while (Length-- != 0) {\r
55 *(Destination8++) = *(Source8++);\r
56 }\r
57 } else if (Source < Destination) {\r
58 Destination8 = (UINT8*)Destination + Length;\r
59 Source8 = (CONST UINT8*)Source + Length;\r
60 while (Length-- != 0) {\r
61 *(--Destination8) = *(--Source8);\r
62 }\r
63 }\r
64 return Destination;\r
65}\r