Hello Joerg,
On 03/01/2013 10:22 AM, Joerg-Cyril.Hoehle@t-systems.com wrote:
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
Michael Stefaniuc wrote:
My idea was to have the whole if else in an inline function.
That's understandable. However in this particular case, we know that in Wine QueryPerfFrequency now yields 10000000, thus Muldiv64 is dead code actually. So I decided to keep the if (freq == 10000000) return idem; in the main code and delegate the unused MulDiv to an auxiliary.
In winmm:waveform, things are a little different, and I was indeed considering integrating the if (num==den) /* typically num = den = samples per second */ into the MulDiv64, should I add one there too.
A general purpose MulDiv however, should not waste cycles performing this particular check.
Regards, Jörg Höhle
Hi,
Michael Stefaniuc wrote:
But I see that even the whole functionality can move to a helper.
That's not a good idea: While the code currently contains two identical pieces of code, it is actually bogus because the capture part should *not* store current time rather than get *recorded* time.
Thus the code looks like there's something that could be refactored, but that would be the wrong refactoring.
Regards, Jörg Höhle