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
+2 -2
View File
@@ -876,13 +876,13 @@ RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf
if( Ivalues == 1 )
ScaledI = 255; // if only one intensity value, always fullbright
else
ScaledI = clamp( int(roundf(I * (255.0f / (Ivalues-1)))), 0, 255 );
ScaledI = clamp( lroundf(I * (255.0f / (Ivalues-1))), 0L, 255L );
int ScaledA;
if( Avalues == 1 )
ScaledA = 255; // if only one alpha value, always opaque
else
ScaledA = clamp( int(roundf(A * (255.0f / (Avalues-1)))), 0, 255 );
ScaledA = clamp( lroundf(A * (255.0f / (Avalues-1))), 0L, 255L );
RageSurfaceColor c;
c.r = uint8_t(ScaledI);