Jordan,

I think the BITxx, SIZExx, and BASExx macros should likely all use a 'u' suffix 
to force inform compilers that these values are to be interpreted as unsigned.  
The one with bits 32..63 set all have a 'ULL' suffix now.

Mike

-----Original Message-----
From: Jordan Justen [mailto:jljus...@gmail.com] 
Sent: Tuesday, March 05, 2013 2:34 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [PATCH] OvmfPkg ResetSystemLib: Fix shutdown via UEFI 
runtime services

On Tue, Mar 5, 2013 at 10:22 AM, Kinney, Michael D
<michael.d.kin...@intel.com> wrote:
> How about using IoBitFieldWrite16() to avoid the sign issues in the 
> module/lib sources and put the burden on the IoLib.
>
>         IoBitFieldWrite16  (PcdGet16 (PcdAcpiPmBaseAddress) + 4, 10, 13, 
> SuspendType);
>         IoOr16 (PcdGet16 (PcdAcpiPmBaseAddress) + 4, BIT13);

Good idea. I'll use your code.

But, what do you think about the BIT0 through BIT31 macros? Should
they have used the 'u' suffix based on Laszlo's concern?

-Jordan

> -----Original Message-----
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Monday, March 04, 2013 5:24 PM
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] [PATCH] OvmfPkg ResetSystemLib: Fix shutdown via UEFI 
> runtime services
>
> On 03/05/13 02:03, Laszlo Ersek wrote:
>
>> Alas these evaluate "low" twice, but I can't readily see a solution with
>> single evaluation. For example
>>
>> #define BITS32(high, low) ((UINT32)-1 << (high) ^ (UINT32)-1 << (low))
>>
>> is undefined behavior for high==32 (which is valid input for the
>> exclusive case).
>
> This works though (since high >= 1):
>
> #define BITS32(high, low) \
>           (~((UINT32)-1 >> 32 - (high)) ^ (UINT32)-1 << (low))
>
> #define BITS64(high, low) \
>           (~((UINT64)-1 >> 64 - (high)) ^ (UINT32)-1 << (low))
>
> Laszlo
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to