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); Mike -----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