mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Fix compiling tests on mac
The mac version of KVZ_GET_TIME macro has many statements, which prevented it being used inside a for loop statement. Added brackets to all versions to prevent this issue arising in the future. Fixes #115.
This commit is contained in:
parent
3c0d72a549
commit
0722f461c5
|
@ -44,7 +44,7 @@
|
|||
(clock_t)->tv_nsec = mts.tv_nsec; \
|
||||
}
|
||||
#else
|
||||
#define KVZ_GET_TIME(clock_t) clock_gettime(CLOCK_MONOTONIC, (clock_t))
|
||||
#define KVZ_GET_TIME(clock_t) { clock_gettime(CLOCK_MONOTONIC, (clock_t)); }
|
||||
#endif
|
||||
|
||||
#define KVZ_CLOCK_T_AS_DOUBLE(ts) ((double)((ts).tv_sec) + (double)((ts).tv_nsec) / (double)1000000000L)
|
||||
|
@ -59,7 +59,7 @@
|
|||
#include <windows.h>
|
||||
|
||||
#define KVZ_CLOCK_T struct _FILETIME
|
||||
#define KVZ_GET_TIME(clock_t) GetSystemTimeAsFileTime(clock_t)
|
||||
#define KVZ_GET_TIME(clock_t) { GetSystemTimeAsFileTime(clock_t); }
|
||||
// _FILETIME has 32bit low and high part of 64bit 100ns resolution timestamp (since 12:00 AM January 1, 1601)
|
||||
#define KVZ_CLOCK_T_AS_DOUBLE(ts) ((double)(((uint64_t)(ts).dwHighDateTime)<<32 | (uint64_t)(ts).dwLowDateTime) / (double)10000000L)
|
||||
#define KVZ_CLOCK_T_DIFF(start, stop) ((double)((((uint64_t)(stop).dwHighDateTime)<<32 | (uint64_t)(stop).dwLowDateTime) - \
|
||||
|
|
|
@ -106,7 +106,7 @@ TEST test_intra_speed(const int width)
|
|||
// Loop until time allocated for test has passed.
|
||||
for (unsigned i = 0;
|
||||
test_end > KVZ_CLOCK_T_AS_DOUBLE(clock_now);
|
||||
++i, KVZ_GET_TIME(&clock_now))
|
||||
++i)
|
||||
{
|
||||
int test = i % NUM_TESTS;
|
||||
uint64_t sum = 0;
|
||||
|
@ -123,6 +123,7 @@ TEST test_intra_speed(const int width)
|
|||
}
|
||||
|
||||
ASSERT(sum > 0);
|
||||
KVZ_GET_TIME(&clock_now)
|
||||
}
|
||||
|
||||
sprintf(test_env.msg, "%.3fM x %s:%s",
|
||||
|
@ -144,7 +145,7 @@ TEST test_inter_speed(const int width)
|
|||
// Loop until time allocated for test has passed.
|
||||
for (unsigned i = 0;
|
||||
test_end > KVZ_CLOCK_T_AS_DOUBLE(clock_now);
|
||||
++i, KVZ_GET_TIME(&clock_now))
|
||||
++i)
|
||||
{
|
||||
int test = i % NUM_TESTS;
|
||||
uint64_t sum = 0;
|
||||
|
@ -166,6 +167,7 @@ TEST test_inter_speed(const int width)
|
|||
}
|
||||
}
|
||||
ASSERT(sum > 0);
|
||||
KVZ_GET_TIME(&clock_now)
|
||||
}
|
||||
|
||||
sprintf(test_env.msg, "%.3fM x %s(%ix%i):%s",
|
||||
|
@ -196,7 +198,7 @@ TEST dct_speed(const int width)
|
|||
// Loop until time allocated for test has passed.
|
||||
for (unsigned i = 0;
|
||||
test_end > KVZ_CLOCK_T_AS_DOUBLE(clock_now);
|
||||
++i, KVZ_GET_TIME(&clock_now))
|
||||
++i)
|
||||
{
|
||||
int test = i % NUM_TESTS;
|
||||
uint64_t sum = 0;
|
||||
|
@ -216,6 +218,7 @@ TEST dct_speed(const int width)
|
|||
}
|
||||
|
||||
ASSERT(sum > 0);
|
||||
KVZ_GET_TIME(&clock_now)
|
||||
}
|
||||
|
||||
sprintf(test_env.msg, "%.3fM x %s:%s",
|
||||
|
|
Loading…
Reference in a new issue