64-bit integer arithmetics
i need to calculate the difference of two FILETIME structures.
a FILETIME struct consists of two 32-bit values representing the high and low order word of a 64-bit integer.
because there is no built in support for 64-bit integers i can''t just substract them how you would do with a normal integer.
so how do i substract two 64-bit ints?
thanks
ridcully
It depends what compiler you are using. If MS VisualC++ then you
can use ULARGE_INTEGER type and LargeIntegerSubtract function.
Copy FILETIME to ULARGE_INTEGER and perform substract operation.
Btw. MS VisualC++ support __int64 type.
If you use another compiler you can write simple function, for
example:
FILETIME SubFiletime(FILETIME ftFirst, FILETIME ftSecond)
{
FILETIME ftRes;
ftRes.dwHighDateTime = ftFirst.dwHighDateTime - ftSecond.dwHighDateTime;
if (ftFirst.dwLowDateTime < ftSecond.dwLowDateTime)
{
ftRes.dwHighDateTime--;
}
ftRes.dwLowDateTime = ftFirst.dwLowDateTime - ftSecond.dwLowDateTime;
return ftRes;
}
Sergej.
can use ULARGE_INTEGER type and LargeIntegerSubtract function.
Copy FILETIME to ULARGE_INTEGER and perform substract operation.
Btw. MS VisualC++ support __int64 type.
If you use another compiler you can write simple function, for
example:
FILETIME SubFiletime(FILETIME ftFirst, FILETIME ftSecond)
{
FILETIME ftRes;
ftRes.dwHighDateTime = ftFirst.dwHighDateTime - ftSecond.dwHighDateTime;
if (ftFirst.dwLowDateTime < ftSecond.dwLowDateTime)
{
ftRes.dwHighDateTime--;
}
ftRes.dwLowDateTime = ftFirst.dwLowDateTime - ftSecond.dwLowDateTime;
return ftRes;
}
Sergej.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement