]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
4ea9375a HT |
3 | Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | EfiCopyMem.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Implementation of the EfiCopyMem routine. This function is broken\r | |
19 | out into its own source file so that it can be excluded from a\r | |
20 | build for a particular platform easily if an optimized version \r | |
21 | is desired.\r | |
22 | \r | |
23 | --*/\r | |
24 | \r | |
25 | #include "Tiano.h"\r | |
26 | \r | |
27 | VOID\r | |
28 | EfiCommonLibCopyMem (\r | |
29 | IN VOID *Destination,\r | |
30 | IN VOID *Source,\r | |
31 | IN UINTN Length\r | |
32 | )\r | |
33 | /*++\r | |
34 | \r | |
35 | Routine Description:\r | |
36 | \r | |
37 | Copy Length bytes from Source to Destination.\r | |
38 | \r | |
39 | Arguments:\r | |
40 | \r | |
41 | Destination - Target of copy\r | |
42 | \r | |
43 | Source - Place to copy from\r | |
44 | \r | |
45 | Length - Number of bytes to copy\r | |
46 | \r | |
47 | Returns:\r | |
48 | \r | |
49 | None\r | |
50 | \r | |
51 | --*/\r | |
52 | {\r | |
53 | CHAR8 *Destination8;\r | |
54 | CHAR8 *Source8;\r | |
55 | \r | |
56 | if (Source < Destination) {\r | |
57 | Destination8 = (CHAR8 *) Destination + Length - 1;\r | |
58 | Source8 = (CHAR8 *) Source + Length - 1;\r | |
59 | while (Length--) {\r | |
60 | *(Destination8--) = *(Source8--);\r | |
61 | }\r | |
62 | } else {\r | |
63 | Destination8 = (CHAR8 *) Destination;\r | |
64 | Source8 = (CHAR8 *) Source;\r | |
65 | while (Length--) {\r | |
66 | *(Destination8++) = *(Source8++);\r | |
67 | }\r | |
68 | }\r | |
69 | }\r |