public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error
@ 2016-11-17  2:03 Michael Kinney
  2016-11-17  2:12 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Kinney @ 2016-11-17  2:03 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ard Biesheuvel, Liming Gao

https://bugzilla.tianocore.org/show_bug.cgi?id=237

Make the smallest change possible to workaround a VS2015
build error.  The change is to the loop that handles the
case where neither the source nor the destination are
64-bit or 32-bit aligned and the logic falls through to
a loop that performs the copy as bytes.  Only the loop
that copies bytes backwards needs to be updated to avoid
the VS2015 build error.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
---
 MdePkg/Library/BaseMemoryLib/CopyMem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Library/BaseMemoryLib/CopyMem.c b/MdePkg/Library/BaseMemoryLib/CopyMem.c
index 6f4fd90..3db25ca 100644
--- a/MdePkg/Library/BaseMemoryLib/CopyMem.c
+++ b/MdePkg/Library/BaseMemoryLib/CopyMem.c
@@ -3,7 +3,7 @@
   out into its own source file so that it can be excluded from a build for a
   particular platform easily if an optimized version is desired.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
   Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.<BR>
   Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 
@@ -143,10 +143,10 @@ InternalMemCopyMem (
         *(Destination8++) = *(Source8++);
       }
     } else if (SourceBuffer < DestinationBuffer) {
-      Destination8 = (UINT8*)DestinationBuffer + Length;
-      Source8 = (CONST UINT8*)SourceBuffer + Length;
+      Destination8 = (UINT8*)DestinationBuffer + (Length - 1);
+      Source8 = (CONST UINT8*)SourceBuffer + (Length - 1);
       while (Length-- != 0) {
-        *(--Destination8) = *(--Source8);
+        *(Destination8--) = *(Source8--);
       }
     }
   }
-- 
2.6.3.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error
  2016-11-17  2:03 [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error Michael Kinney
@ 2016-11-17  2:12 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2016-11-17  2:12 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Ard Biesheuvel

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Kinney, Michael D 
Sent: Thursday, November 17, 2016 10:04 AM
To: edk2-devel@lists.01.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Gao, Liming <liming.gao@intel.com>
Subject: [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error

https://bugzilla.tianocore.org/show_bug.cgi?id=237

Make the smallest change possible to workaround a VS2015
build error.  The change is to the loop that handles the
case where neither the source nor the destination are
64-bit or 32-bit aligned and the logic falls through to
a loop that performs the copy as bytes.  Only the loop
that copies bytes backwards needs to be updated to avoid
the VS2015 build error.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
---
 MdePkg/Library/BaseMemoryLib/CopyMem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Library/BaseMemoryLib/CopyMem.c b/MdePkg/Library/BaseMemoryLib/CopyMem.c
index 6f4fd90..3db25ca 100644
--- a/MdePkg/Library/BaseMemoryLib/CopyMem.c
+++ b/MdePkg/Library/BaseMemoryLib/CopyMem.c
@@ -3,7 +3,7 @@
   out into its own source file so that it can be excluded from a build for a
   particular platform easily if an optimized version is desired.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
   Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.<BR>
   Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 
@@ -143,10 +143,10 @@ InternalMemCopyMem (
         *(Destination8++) = *(Source8++);
       }
     } else if (SourceBuffer < DestinationBuffer) {
-      Destination8 = (UINT8*)DestinationBuffer + Length;
-      Source8 = (CONST UINT8*)SourceBuffer + Length;
+      Destination8 = (UINT8*)DestinationBuffer + (Length - 1);
+      Source8 = (CONST UINT8*)SourceBuffer + (Length - 1);
       while (Length-- != 0) {
-        *(--Destination8) = *(--Source8);
+        *(Destination8--) = *(Source8--);
       }
     }
   }
-- 
2.6.3.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-17  2:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-17  2:03 [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error Michael Kinney
2016-11-17  2:12 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox