It's kind of ironic to have a Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data.
Am I the only one that enables all
runtime checks in Visual Studio?
I have made the following change to fix it:
template < typename E >
static void RegMultiplyThrow( const unsigned __int64& a, const unsigned __int64& b, unsigned __int64* pRet ) SAFEINT_CPP_THROW
unsigned __int32 aHigh, aLow, bHigh, bLow;
static const unsigned __int64 mask = 0x00000000FFffFFff;
aHigh = (unsigned __int32)(a >> 32);
//aLow = (unsigned __int32)a;
aLow = (unsigned __int32)(a & mask);
bHigh = (unsigned __int32)(b >> 32);
//bLow = (unsigned __int32)b;
bLow = (unsigned __int32)(b & mask);
Question is: why wasn't this (or some more portable alternative) already there?