]> git.proxmox.com Git - mirror_edk2.git/commit - MdePkg/Library/BaseSafeIntLib/SafeIntLib.c
MdePkg/BaseSafeIntLib: Fix VS20xx IA32 link failures
authorMichael D Kinney <michael.d.kinney@intel.com>
Wed, 12 Feb 2020 21:17:24 +0000 (13:17 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 13 Feb 2020 01:42:50 +0000 (01:42 +0000)
commit02b7b861b18afd1744f462878060abda38eccb44
treec3e57e79a341bde4a4189ae731f096a767800dd7
parentec97412b7c413573a681e275d55f50dea490fb24
MdePkg/BaseSafeIntLib: Fix VS20xx IA32 link failures

https://bugzilla.tianocore.org/show_bug.cgi?id=2525

SafeUint64Mult() looks for 64-bit overflows and performs
several 32-bit multiples with 64-bit results to check for
all possible overflow conditions.  IA32 builds using VS20xx
with optimizations enabled are producing a reference to
the _allmull intrinsic.

The fix is to use MultU64x64() instead of '*' for
these operations.  These are safe because the inputs
are guaranteed to have the upper 32-bits clear, which
means MultU64x64() can never overflow with those inputs.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/BaseSafeIntLib/SafeIntLib.c