From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 89A9881F3A for ; Wed, 16 Nov 2016 18:03:59 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 16 Nov 2016 18:03:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,651,1473145200"; d="scan'208";a="1069573312" Received: from mdkinney-mobl.amr.corp.intel.com ([10.232.100.21]) by fmsmga001.fm.intel.com with ESMTP; 16 Nov 2016 18:03:47 -0800 From: Michael Kinney To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Liming Gao Date: Wed, 16 Nov 2016 18:03:45 -0800 Message-Id: <1479348225-15712-1-git-send-email-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.6.3.windows.1 Subject: [Patch] MdePkg/BaseMemoryLib: Fix VS2015 build error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 02:03:59 -0000 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 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney --- 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.
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
Copyright (c) 2016, Linaro Ltd. All rights reserved.
@@ -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