\r
#include <Base.h>\r
#include <Library/SafeIntLib.h>\r
+#include <Library/BaseLib.h>\r
\r
\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
// 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
//\r
// b * d\r
//\r
OUT INT32 *Result\r
)\r
{\r
- return SafeInt64ToInt32 (((INT64)Multiplicand) *((INT64)Multiplier), Result);\r
+ return SafeInt64ToInt32 (MultS64x64 (Multiplicand, Multiplier), Result);\r
}\r
\r
/**\r
\r
#include <Base.h>\r
#include <Library/SafeIntLib.h>\r
+#include <Library/BaseLib.h>\r
\r
/**\r
INT32 -> UINTN conversion\r
OUT INTN *Result\r
)\r
{\r
- return SafeInt64ToIntn (((INT64)Multiplicand) *((INT64)Multiplier), Result);\r
+ return SafeInt64ToIntn (MultS64x64 (Multiplicand, Multiplier), Result);\r
}\r
\r