From f8b5024c096d0d8c663c151cbf72cad3dd02ea52 Mon Sep 17 00:00:00 2001 From: Tom Lally Date: Wed, 7 Sep 2022 01:27:52 +0100 Subject: [PATCH] Improved macro clarity. (#188) --- src/Cafe/HW/Espresso/PPCTimer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Cafe/HW/Espresso/PPCTimer.cpp b/src/Cafe/HW/Espresso/PPCTimer.cpp index 2a1a7669..e147ac25 100644 --- a/src/Cafe/HW/Espresso/PPCTimer.cpp +++ b/src/Cafe/HW/Espresso/PPCTimer.cpp @@ -111,10 +111,10 @@ uint64 PPCTimer_tscToMicroseconds(uint64 us) uint64 remainder; -#if _MSC_VER < 1923 || defined(__clang__) - const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder); -#else +#if defined(_MSC_VER) && _MSC_VER >= 1923 const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder); +#else + const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder); #endif return microseconds; @@ -159,12 +159,13 @@ uint64 PPCTimer_getFromRDTSC() #endif uint64 remainder; -#if _MSC_VER < 1923 || defined(__clang__) - uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder); +#if defined(_MSC_VER) && _MSC_VER >= 1923 + uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder); #else - uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder); + uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder); #endif + _rdtscAcc.low = remainder; _rdtscAcc.high = 0;