]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibSse2/CopyMemWrapper.c
1. Change 0 == Length style to Length == 0
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / CopyMemWrapper.c
CommitLineData
e1f414b6 1/** @file\r
2 CopyMem() implementation.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
2bfb6009 13 The following BaseMemoryLib instances contain the same copy of this file:\r
e1f414b6 14\r
15 BaseMemoryLib\r
16 BaseMemoryLibMmx\r
17 BaseMemoryLibSse2\r
18 BaseMemoryLibRepStr\r
2bfb6009
LG
19 BaseMemoryLibOptDxe\r
20 BaseMemoryLibOptPei\r
e1f414b6 21 PeiMemoryLib\r
22 DxeMemoryLib\r
23\r
24**/\r
25\r
1efcc4ae 26\r
f734a10a 27\r
e1f414b6 28\r
29#include "MemLibInternals.h"\r
30\r
31/**\r
32 Copies a source buffer to a destination buffer, and returns the destination buffer.\r
33\r
34 This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns\r
35 DestinationBuffer. The implementation must be reentrant, and it must handle the case\r
36 where SourceBuffer overlaps DestinationBuffer.\r
37 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT(). \r
38 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(). \r
39\r
40 @param DestinationBuffer Pointer to the destination buffer of the memory copy.\r
41 @param SourceBuffer Pointer to the source buffer of the memory copy.\r
42 @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.\r
43\r
44 @return DestinationBuffer.\r
45\r
46**/\r
47VOID *\r
48EFIAPI\r
49CopyMem (\r
50 OUT VOID *DestinationBuffer,\r
51 IN CONST VOID *SourceBuffer,\r
52 IN UINTN Length\r
53 )\r
54{\r
2bfb6009 55 if (Length == 0) {\r
e1f414b6 56 return DestinationBuffer;\r
57 }\r
58 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
59 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
60\r
61 if (DestinationBuffer == SourceBuffer) {\r
62 return DestinationBuffer;\r
63 }\r
64 return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);\r
65}\r