1
0
forked from mirrors/0ad

split debug_assert into ENSURE and ASSERT as discussed in a previous meeting.

the old debug_assert always ran and tested the expression, which slows
down release builds. wrapping them in #ifndef NDEBUG is clumsy. the new
ASSERT behaves like assert and ENSURE like the old debug_assert. Let's
change any time-critical but not-super-important ENSURE to ASSERT to
speed up release builds. (already done in bits.h and unique_range.h)

This was SVN commit r9362.
This commit is contained in:
janwas
2011-04-30 13:01:45 +00:00
parent 6c915291cc
commit 4663ac0fe7
225 changed files with 916 additions and 932 deletions
+3 -3
View File
@@ -118,12 +118,12 @@ double timer_Time()
#if OS_WIN
t = whrt_Time();
#elif HAVE_CLOCK_GETTIME
debug_assert(start.tv_sec || start.tv_nsec); // must have called timer_LatchStartTime first
ENSURE(start.tv_sec || start.tv_nsec); // must have called timer_LatchStartTime first
struct timespec cur;
(void)clock_gettime(CLOCK_REALTIME, &cur);
t = (cur.tv_sec - start.tv_sec) + (cur.tv_nsec - start.tv_nsec)*1e-9;
#elif HAVE_GETTIMEOFDAY
debug_assert(start.tv_sec || start.tv_usec); // must have called timer_LatchStartTime first
ENSURE(start.tv_sec || start.tv_usec); // must have called timer_LatchStartTime first
struct timeval cur;
gettimeofday(&cur, 0);
t = (cur.tv_sec - start.tv_sec) + (cur.tv_usec - start.tv_usec)*1e-6;
@@ -202,7 +202,7 @@ void timer_DisplayClientTotals()
while(clients)
{
// (make sure list and count are consistent)
debug_assert(numClients != 0);
ENSURE(numClients != 0);
TimerClient* tc = clients;
clients = tc->next;
numClients--;