We need to "combine" two 32bit values into a 64 bit value as "high and low".
In c/c++ we could do this using either a union overlay or a bit-shift
////////////////////////////////////////////////////////////
// my 32bit values
long lMyLow = 1234;
long lMyHigh = 5678;
////////////////////////////
// combine as union overlay
/*
// Microsoft LARGE_INTEGER union type
typedef union _LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
};
struct {
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER;
*/
LARGE_INTEGER LIMyValue;
LIMyValue.LowPart = lMyLow;
LIMyValue.HighPart = lMyHigh;
// result - LIMyValue.QuadPart == 24386824307922
////////////////////////////
// combine as bit shift
unsigned __int64 ui64MyValue = 0;
ui64MyValue = ((unsigned __int64)lMyHigh << (unsigned __int64)32L) | (unsigned __int64)lMyLow;
// result - ui64MyValue == 24386824307922
How would you do that in JavaScript or Java?