public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Michael Kinney <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Liming Gao <liming.gao@intel.com>
Subject: [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error
Date: Wed, 16 Nov 2016 18:03:45 -0800	[thread overview]
Message-ID: <1479348225-15712-1-git-send-email-michael.d.kinney@intel.com> (raw)

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



             reply	other threads:[~2016-11-17  2:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17  2:03 Michael Kinney [this message]
2016-11-17  2:12 ` [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479348225-15712-1-git-send-email-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox