- Changed gotos as cleanup mechanism to a scoped delete template.

- Removed unnecessary ptr casts to ints to allow to compile on 64bits systems.
- Added custom and portable qsort_r.
- Use gettimeofday() as performance timer on unix/bsd/osx
- Moved variables from rcCompactSpan to separate arrays.
This commit is contained in:
Mikko Mononen
2009-09-28 09:54:37 +00:00
parent 404491901a
commit ed73b46308
16 changed files with 1643 additions and 3108 deletions
+8 -24
View File
@@ -21,38 +21,22 @@ int rcGetDeltaTimeUsec(rcTimeVal start, rcTimeVal end)
return (int)(elapsed*1000000 / freq);
}
#elif defined(__MACH__)
// OSX
#include <mach/mach_time.h>
rcTimeVal rcGetPerformanceTimer()
{
return mach_absolute_time();
}
int rcGetDeltaTimeUsec(rcTimeVal start, rcTimeVal end)
{
static mach_timebase_info_data_t timebaseInfo;
if (timebaseInfo.denom == 0)
mach_timebase_info(&timebaseInfo);
uint64_t elapsed = end - start;
uint64_t nanosec = elapsed * timebaseInfo.numer / timebaseInfo.denom;
return (int)(nanosec / 1000);
}
#else
// TODO: Linux, etc
// Linux, BSD, OSX
#include <sys/time.h>
rcTimeVal rcGetPerformanceTimer()
{
return 0;
timeval now;
gettimeofday(&now, NULL);
return (rcTimeVal)now.tv_sec*1000000L + (rcTimeVal)now.tv_usec;
}
int rcGetDeltaTimeUsec(rcTimeVal start, rcTimeVal end)
{
return 0;
return (int)(end - start);
}
#endif
#endif