Float to int is slow on ppc. It requires a store, a big stall, and then a load. It's even worse on a G5 if the compiler is dumb (and let's face it, I'm using gcc here...). Just use lroundf when we want an int. It will certainly be no slower.

This commit is contained in:
Steve Checkoway
2007-01-02 23:36:44 +00:00
parent 7a6eabd616
commit eb0b26cd82
17 changed files with 37 additions and 37 deletions
@@ -58,7 +58,7 @@ void SetThreadPrecedence( float prec )
// Real values are between 0 and 63.
if( CLAMP(prec, 0.0f, 1.0f) )
LOG->Warn( "Thread precedence clamped to %f.", prec );
thread_precedence_policy po = { integer_t( roundf(prec * 63) ) };
thread_precedence_policy po = { integer_t( lroundf(prec * 63) ) };
kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY,
(thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT );