Hello Yonghong and Andrew,

This patch may cause issues when compiling MSVC x IA32 as the optimizer might 
replace the shift with an intrinsic.
I suggest you to use LShiftU64() rather than the << operator.

Regards,
Marvin.

> -----Original Message-----
> From: edk2-devel [mailto:[email protected]] On Behalf Of
> Yonghong Zhu
> Sent: Wednesday, August 2, 2017 11:28 AM
> To: [email protected]
> Cc: Michael D Kinney <[email protected]>; Andrew Fish
> <[email protected]>; Liming Gao <[email protected]>
> Subject: [edk2] [Patch 4/4] MdePkg: Fix Xcode 9 Beta treating 32-bit left 
> shift
> as undefined
> 
> Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=635
> 
> Cc: Liming Gao <[email protected]>
> Cc: Michael D Kinney <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Andrew Fish <[email protected]>
> ---
>  MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
> b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
> index e3b2846..ce1fe0a 100644
> --- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
> +++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
> @@ -38,18 +38,18 @@ FillBuf (
>    )
>  {
>    //
>    // Left shift NumOfBits of bits in advance
>    //
> -  Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);
> +  Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
> 
>    //
>    // Copy data needed in bytes into mSbuBitBuf
>    //
>    while (NumOfBits > Sd->mBitCount) {
> 
> -    Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16)
> (NumOfBits - Sd->mBitCount)));
> +    Sd->mBitBuf |= (UINT32) (((UINT64)Sd->mSubBitBuf) << (NumOfBits =
> (UINT16) (NumOfBits - Sd->mBitCount)));
> 
>      if (Sd->mCompSize > 0) {
>        //
>        // Get 1 byte into SubBitBuf
>        //
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to