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