Improved macro clarity. (#188)

This commit is contained in:
Tom Lally 2022-09-07 01:27:52 +01:00 committed by GitHub
parent e5d7d5d173
commit f8b5024c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -111,10 +111,10 @@ uint64 PPCTimer_tscToMicroseconds(uint64 us)
uint64 remainder; uint64 remainder;
#if _MSC_VER < 1923 || defined(__clang__) #if defined(_MSC_VER) && _MSC_VER >= 1923
const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder);
#else
const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder); const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder);
#else
const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder);
#endif #endif
return microseconds; return microseconds;
@ -159,12 +159,13 @@ uint64 PPCTimer_getFromRDTSC()
#endif #endif
uint64 remainder; uint64 remainder;
#if _MSC_VER < 1923 || defined(__clang__) #if defined(_MSC_VER) && _MSC_VER >= 1923
uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder); uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder);
#else #else
uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder); uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder);
#endif #endif
_rdtscAcc.low = remainder; _rdtscAcc.low = remainder;
_rdtscAcc.high = 0; _rdtscAcc.high = 0;