v2: Add [LibraryClasses] section in INF file and refine coding style.
There are VS2015 NOOPT IA32 build failure like below in BaseSafeIntLib.
XXX.lib(XXX.obj): error LNK2001: unresolved external symbol __allmul
XXX.lib(XXX.obj): error LNK2001: unresolved external symbol __allshl
XXX.lib(XXX.obj): error LNK2001: unresolved external symbol __aullshr
This patch replaces direct shift/multiplication of 64-bit integer
with related function call to fix these failure.
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
\r
[Packages]\r
MdePkg/MdePkg.dec\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
\r
#include <Base.h>\r
#include <Library/SafeIntLib.h>\r
\r
#include <Base.h>\r
#include <Library/SafeIntLib.h>\r
+#include <Library/BaseLib.h>\r
// b * c must be less than 2^32 or there would be bits in the high 64-bits\r
// then there must be no overflow of the resulting values summed up.\r
//\r
// b * c must be less than 2^32 or there would be bits in the high 64-bits\r
// then there must be no overflow of the resulting values summed up.\r
//\r
- DwordA = (UINT32)(Multiplicand >> 32);\r
- DwordC = (UINT32)(Multiplier >> 32);\r
+ DwordA = (UINT32)RShiftU64 (Multiplicand, 32);\r
+ DwordC = (UINT32)RShiftU64 (Multiplier, 32);\r
\r
//\r
// common case -- if high dwords are both zero, no chance for overflow\r
\r
//\r
// common case -- if high dwords are both zero, no chance for overflow\r
// now sum them all up checking for overflow.\r
// shifting is safe because we already checked for overflow above\r
//\r
// now sum them all up checking for overflow.\r
// shifting is safe because we already checked for overflow above\r
//\r
- if (!RETURN_ERROR (SafeUint64Add (ProductBC << 32, ProductAD << 32, &UnsignedResult))) {\r
+ if (!RETURN_ERROR (SafeUint64Add (LShiftU64 (ProductBC, 32), LShiftU64 (ProductAD, 32), &UnsignedResult))) {\r
OUT INT32 *Result\r
)\r
{\r
OUT INT32 *Result\r
)\r
{\r
- return SafeInt64ToInt32 (((INT64)Multiplicand) *((INT64)Multiplier), Result);\r
+ return SafeInt64ToInt32 (MultS64x64 (Multiplicand, Multiplier), Result);\r
\r
#include <Base.h>\r
#include <Library/SafeIntLib.h>\r
\r
#include <Base.h>\r
#include <Library/SafeIntLib.h>\r
+#include <Library/BaseLib.h>\r
\r
/**\r
INT32 -> UINTN conversion\r
\r
/**\r
INT32 -> UINTN conversion\r
OUT INTN *Result\r
)\r
{\r
OUT INTN *Result\r
)\r
{\r
- return SafeInt64ToIntn (((INT64)Multiplicand) *((INT64)Multiplier), Result);\r
+ return SafeInt64ToIntn (MultS64x64 (Multiplicand, Multiplier), Result);\r