]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseMemoryLib/CopyMem.c
MdePkg/BaseMemoryLib: Fix VS2015 build error
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLib / CopyMem.c
index 6f4fd900df5d2e50729f27115646a8ea3cd789cb..3db25ca851a117175fe10daffb4dbba5c8e50b22 100644 (file)
@@ -3,7 +3,7 @@
   out into its own source file so that it can be excluded from a build for a\r
   particular platform easily if an optimized version is desired.\r
 \r
   out into its own source file so that it can be excluded from a build for a\r
   particular platform easily if an optimized version is desired.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.<BR>\r
   Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
 \r
   Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.<BR>\r
   Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
 \r
@@ -143,10 +143,10 @@ InternalMemCopyMem (
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
-      Destination8 = (UINT8*)DestinationBuffer + Length;\r
-      Source8 = (CONST UINT8*)SourceBuffer + Length;\r
+      Destination8 = (UINT8*)DestinationBuffer + (Length - 1);\r
+      Source8 = (CONST UINT8*)SourceBuffer + (Length - 1);\r
       while (Length-- != 0) {\r
       while (Length-- != 0) {\r
-        *(--Destination8) = *(--Source8);\r
+        *(Destination8--) = *(Source8--);\r
       }\r
     }\r
   }\r
       }\r
     }\r
   }\r