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
+3 -3
View File
@@ -69,7 +69,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i
case WorkoutProgram_FatBurn:
{
float fMeter = SCALE( iSongInBodyIndex % 4, 0.0f, 3.0f, (float)iMinMeter, (float)iMaxMeter );
iMeter = (int)roundf( fMeter );
iMeter = lroundf( fMeter );
}
break;
case WorkoutProgram_FitnessTest:
@@ -92,7 +92,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i
break;
case 4:
case 5:
iMeter = (int) roundf( SCALE( 0.5f, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter ) );
iMeter = lroundf( SCALE( 0.5f, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter ) );
break;
}
}
@@ -107,7 +107,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i
float fMeter = SCALE( iSongInBodyIndex % 4, 0.0f, 3.0f, (float)iMinMeter, (float)iMaxMeter );
if( (iSongInBodyIndex % 8) >= 4 )
fMeter = SCALE( fMeter, (float)iMinMeter, (float)iMaxMeter, (float)iMaxMeter, (float)iMinMeter );
iMeter = (int)roundf( fMeter );
iMeter = lroundf( fMeter );
}
break;
case WorkoutProgram_Flat: