mmdevapi: Prevent 64 bit overflow within a few days of audio device use. (try 2)
Michael Stefaniuc
mstefani at redhat.com
Fri Mar 1 04:42:23 CST 2013
Hello Joerg,
On 03/01/2013 10:22 AM, Joerg-Cyril.Hoehle at t-systems.com wrote:
> The idea to replace X * numerator / denominator
> by X / den * mul + remainder from euclidian division
> came from
> http://blog.airsource.co.uk/index.php/2010/03/15/quelle-heure-est-il/
>
> M. Stefaniuc suggested an inline function. The MulDiv64 inline has the benefit
> of ensuring unsigned arithmetic, matching GetPosition UINT64 output.
My idea was to have the whole if else in an inline function.
But I see that even the whole functionality can move to a helper.
Something like this:
static inline ULONGLONG get_qpctime(void)
{
LARGE_INTEGER stamp, freq;
QueryPerformanceCounter(&stamp);
QueryPerformanceFrequency(&freq);
if(freq.QuadPart == 10000000)
return stamp.QuadPart;
else
return stamp.QuadPart / freq.QuadPart * 10000000
+ stamp.QuadPart % freq.QuadPart * 10000000 /
freq.QuadPart;
}
bye
michael
More information about the wine-devel
mailing list