Acidanthera UEFI Development Kit based on EDK II edk2-stable202311
Go to file
Ard Biesheuvel b331b99fae MdePkg/BaseLib: do not rely on undefined behavior in arithmetic shift
The runtime test whether the compiler supports arithmetic shift of
negative signed numbers currently relies on undefined behavior in C,
which means that all bets are off regarding whether the condition
that follows passes or fails, regardless of whether the compiler in
fact supports arithmetic shift or not.

Relevant quote from ISO C99 (6.5.7/4)

  The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits
  are filled with zeros. If E1 has an unsigned type, the value of the result
  is E1 × 2^E2, reduced modulo one more than the maximum value representable
  in the result type. If E1 has a signed type and nonnegative value, and
  E1 × 2^E2 is representable in the result type, then that is the resulting
  value; otherwise, the behavior is undefined.

For historic purposes, let's keep the test in place (although it is doubtful
we actually need it) but rewrite it in a way that prevents compilers from
this century from doing whacky things with it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19580 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-31 10:47:22 +00:00
AppPkg AppPkg/Applications/Python/Python-2.7.10/*/pyconfig.h: Update pyconfig for Python 2.7.10 compliance. 2015-12-29 02:53:10 +00:00
ArmPkg ArmPkg/ArmSoftfloatLib: add missing entry points for RVCT 2015-12-17 16:29:23 +00:00
ArmPlatformPkg ArmVExpressPkg/ArmVExpress-FVP-AArch64: run GICv3 in v3 mode 2015-12-15 13:08:56 +00:00
ArmVirtPkg ArmVirtPkg/ArmVirtXen: add ARM support 2015-12-17 17:11:33 +00:00
BaseTools BaseTool/UPT: Fix a typo issue 2015-12-30 02:22:30 +00:00
BeagleBoardPkg BeagleBoardPkg: remove ArmPlatformGlobalVariableLib resolution 2015-11-27 17:05:24 +00:00
Conf EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
CorebootModulePkg CorebootModulePkg:Removing EFI_RESOURCE_ATTRIBUTE_TESTED 2015-08-18 16:08:22 +00:00
CorebootPayloadPkg CorebootPayloadPkg PlatformHookLib: Fix GCC build failure 2015-11-30 21:11:29 +00:00
CryptoPkg CryptoPkg: fix build support under RVCT 2015-12-17 17:02:06 +00:00
DuetPkg DuetPkg: Fix GCC error to avoid the duplicated global variable in SmbiosGenDxe 2015-12-18 02:29:12 +00:00
EdkCompatibilityPkg EdkCompatibilityPkg: Fix GCC error to avoid the duplicated global variables 2015-12-18 02:28:18 +00:00
EdkShellBinPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EdkShellPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EmbeddedPkg EmbeddedPkg: Convert all .uni files to utf-8 2015-12-15 04:51:40 +00:00
EmulatorPkg EmulatorPkg: Convert all .uni files to utf-8 2015-12-15 04:51:49 +00:00
FatBinPkg FatBinPkg: Update EBC/IA32/X64/IPF binaries 2015-08-28 03:14:25 +00:00
IntelFrameworkModulePkg IntelFrameworkModulePkg: Remove the undefined PCD help and prompt strings 2015-12-24 02:31:25 +00:00
IntelFrameworkPkg IntelFrameworkPkg: Convert all .uni files to utf-8 2015-12-15 04:52:47 +00:00
IntelFspPkg Handle extra module patchable PCD variable in Linux map. 2015-09-06 22:36:43 +00:00
IntelFspWrapperPkg Fix >4G issue on IDT not restored correctly. 2015-12-15 04:27:00 +00:00
MdeModulePkg MdeModulePkg Variable: Add a missing variable info record 2015-12-30 05:09:50 +00:00
MdePkg MdePkg/BaseLib: do not rely on undefined behavior in arithmetic shift 2015-12-31 10:47:22 +00:00
NetworkPkg NetworkPkg: Support DNS4/6 GeneralLookUp feature 2015-12-30 08:10:55 +00:00
Nt32Pkg Nt32Pkg/WinNtSimpleFileSystemDxe: Fix memory leak 2015-12-24 06:30:55 +00:00
Omap35xxPkg Omap35xxPkg SerialPortLib: Implement Get(Set)Control/SetAttributes 2015-11-26 08:49:53 +00:00
OptionRomPkg OptionRomPkg: Remove redundant included header file defintion in Ax88772.h and Ax88772b.h files 2015-07-08 02:56:54 +00:00
OvmfPkg OvfmPkg/XenHypercallLib: add missing GCC_ASM_EXPORT to XenHypercall2 2015-12-17 17:10:59 +00:00
PcAtChipsetPkg PcAtChipsetPkg/PcRtc: Modify INF file content to follow INF spec 2015-12-24 06:36:57 +00:00
PerformancePkg PerformancePkg: Convert all .uni files to utf-8 2015-12-15 04:57:45 +00:00
QuarkPlatformPkg QuarkPlatformPkg/PlatformSecLib: Sync Flat32.S with Flat32.asm 2015-12-16 17:34:23 +00:00
QuarkSocPkg QuarkSocPkg: Add new package for Quark SoC X1000 2015-12-15 19:22:23 +00:00
SecurityPkg SecurityPkg AuthVariableLib: Correct comment/error log about CleanCertsFromDb 2015-12-29 09:07:32 +00:00
ShellBinPkg ShellBinPkg: Ia32/X64 Shell binary update. 2015-12-25 04:20:28 +00:00
ShellPkg ShellPkg: Fix memory leak in function 'EfiShellSetCurDir' and 'EfiShellSetMap'. 2015-12-25 01:52:56 +00:00
SourceLevelDebugPkg SourceLevelDebugPkg: Correct gEfiDebugAgentGuid usage in DxeDebugAgentLib 2015-12-17 08:29:58 +00:00
StdLib StdLib: remove mention of ARMGCC 2015-08-12 05:25:12 +00:00
StdLibPrivateInternalFiles */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
UefiCpuPkg UefiCpuPkg: Add the missing module uni for CpuS3DataDxe 2015-12-24 02:30:43 +00:00
UnixPkg UnixPkg: Remove UnixPkg files (It is replaced by EmulatorPkg) 2013-07-29 21:09:55 +00:00
Vlv2DeviceRefCodePkg Vlv2TbltDevicePkg/Vlv2DeviceRefCodePkg: 2015-11-10 07:47:29 +00:00
Vlv2TbltDevicePkg Vlv2TbltDevicePkg: Convert all .uni files to utf-8 2015-12-15 04:59:37 +00:00
.gitignore EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
BuildNotes2.txt Update to new SVN URL in readme.txt 2013-06-08 05:26:39 +00:00
Edk2Setup.bat BaseTools: Update Edk2Setup.bat to support multiple workspaces 2015-10-08 09:29:36 +00:00
Maintainers.txt Maintainers.txt: Update maintainers for Quark*Pkg 2015-12-17 07:33:33 +00:00
edksetup.bat BaseTools: Add VS2015 tool chain in tools_def.template 2015-12-03 03:19:01 +00:00
edksetup.sh BaseTools: Update edksetup.sh to support multiple workspaces 2015-10-08 09:29:56 +00:00