A
Andre
Hi,
Could someone tell me what's wrong with the following program? I think
there is something wrong with the size of integers I'm using, but not
sure. When I execute it, I get the following output, but the value of r
in 3 should be 0x000BFD0600000000.
Thanks,
Andre
***********************************************************************
1: 0000000000000000
2: 00000000000BFD06
3: 0000000000000000
4: 00000000A28B24BD
timeLow: A28B24BD
timeHigh: 000BFD06
time: 00000000A28B24BD -6734248419340058625
***********************************************************************
#include <stdio.h>
typedef int Int32;
typedef long long Int64;
inline Int64 form64( Int32 low, Int32 high )
{
Int64 r = 0;
printf("1: %016X\n", r);
r = high;
printf("2: %016X\n", r);
r = r<<32;
printf("3: %016X\n", r);
r = r|low;
printf("4: %016X\n", r);
return r;
}
int main()
{
Int32 timeLow = 0xA28B24BD;
Int32 timeHigh = 0x000BFD06;
Int64 time = form64(timeLow, timeHigh);
printf("timeLow: %08X\n", timeLow);
printf("timeHigh: %08X\n", timeHigh);
printf("time: %016X %lld\n\n", time, time);
return 0;
}
Could someone tell me what's wrong with the following program? I think
there is something wrong with the size of integers I'm using, but not
sure. When I execute it, I get the following output, but the value of r
in 3 should be 0x000BFD0600000000.
Thanks,
Andre
***********************************************************************
1: 0000000000000000
2: 00000000000BFD06
3: 0000000000000000
4: 00000000A28B24BD
timeLow: A28B24BD
timeHigh: 000BFD06
time: 00000000A28B24BD -6734248419340058625
***********************************************************************
#include <stdio.h>
typedef int Int32;
typedef long long Int64;
inline Int64 form64( Int32 low, Int32 high )
{
Int64 r = 0;
printf("1: %016X\n", r);
r = high;
printf("2: %016X\n", r);
r = r<<32;
printf("3: %016X\n", r);
r = r|low;
printf("4: %016X\n", r);
return r;
}
int main()
{
Int32 timeLow = 0xA28B24BD;
Int32 timeHigh = 0x000BFD06;
Int64 time = form64(timeLow, timeHigh);
printf("timeLow: %08X\n", timeLow);
printf("timeHigh: %08X\n", timeHigh);
printf("time: %016X %lld\n\n", time, time);
return 0;
}