lroundf -> lrintf.
This commit is contained in:
@@ -104,8 +104,8 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms )
|
||||
long int MaxBPM = INT_MIN;
|
||||
for( unsigned i = 0; i < BPMS.size(); ++i )
|
||||
{
|
||||
MinBPM = min( MinBPM, lroundf(BPMS[i]) );
|
||||
MaxBPM = max( MaxBPM, lroundf(BPMS[i]) );
|
||||
MinBPM = min( MinBPM, lrintf(BPMS[i]) );
|
||||
MaxBPM = max( MaxBPM, lrintf(BPMS[i]) );
|
||||
}
|
||||
if( MinBPM == MaxBPM )
|
||||
{
|
||||
|
||||
@@ -191,7 +191,7 @@ void BitmapText::BuildChars()
|
||||
switch( m_VertAlign )
|
||||
{
|
||||
case VertAlign_Top: iY = 0; break;
|
||||
case VertAlign_Middle: iY = -lroundf(m_size.y/2.0f); break;
|
||||
case VertAlign_Middle: iY = -lrintf(m_size.y/2.0f); break;
|
||||
case VertAlign_Bottom: iY = -(int)m_size.y; break;
|
||||
default: ASSERT( false );
|
||||
}
|
||||
@@ -209,7 +209,7 @@ void BitmapText::BuildChars()
|
||||
switch( m_HorizAlign )
|
||||
{
|
||||
case HorizAlign_Left: iX = 0; break;
|
||||
case HorizAlign_Center: iX = -lroundf(iLineWidth/2.0f); break;
|
||||
case HorizAlign_Center: iX = -lrintf(iLineWidth/2.0f); break;
|
||||
case HorizAlign_Right: iX = -iLineWidth; break;
|
||||
default: ASSERT( false );
|
||||
}
|
||||
@@ -254,8 +254,8 @@ void BitmapText::DrawChars()
|
||||
return;
|
||||
|
||||
const int iNumGlyphs = m_pTextures.size();
|
||||
int iStartGlyph = lroundf( SCALE( m_pTempState->crop.left, 0.f, 1.f, 0, (float) iNumGlyphs ) );
|
||||
int iEndGlyph = lroundf( SCALE( m_pTempState->crop.right, 0.f, 1.f, (float) iNumGlyphs, 0 ) );
|
||||
int iStartGlyph = lrintf( SCALE( m_pTempState->crop.left, 0.f, 1.f, 0, (float) iNumGlyphs ) );
|
||||
int iEndGlyph = lrintf( SCALE( m_pTempState->crop.right, 0.f, 1.f, (float) iNumGlyphs, 0 ) );
|
||||
iStartGlyph = clamp( iStartGlyph, 0, iNumGlyphs );
|
||||
iEndGlyph = clamp( iEndGlyph, 0, iNumGlyphs );
|
||||
|
||||
@@ -565,7 +565,7 @@ void BitmapText::DrawPrimitives()
|
||||
vector<RageVector3> vGlyphJitter;
|
||||
if( m_bJitter )
|
||||
{
|
||||
int iSeed = lroundf( RageTimer::GetTimeSinceStartFast()*8 );
|
||||
int iSeed = lrintf( RageTimer::GetTimeSinceStartFast()*8 );
|
||||
RandomGen rnd( iSeed );
|
||||
|
||||
for( unsigned i=0; i<m_aVertices.size(); i+=4 )
|
||||
|
||||
@@ -56,7 +56,7 @@ void FontPage::Load( const FontPageSettings &cfg )
|
||||
if( cfg.m_fScaleAllWidthsBy != 1 )
|
||||
{
|
||||
for( int i=0; i<m_pTexture->GetNumFrames(); i++ )
|
||||
aiFrameWidths[i] = lroundf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy );
|
||||
aiFrameWidths[i] = lrintf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy );
|
||||
}
|
||||
|
||||
m_iCharToGlyphNo = cfg.CharToGlyphNo;
|
||||
|
||||
@@ -20,7 +20,7 @@ NoteType NoteDataUtil::GetSmallestNoteTypeForMeasure( const NoteData &n, int iMe
|
||||
for( nt=(NoteType)0; nt<NUM_NoteType; nt=NoteType(nt+1) ) // for each NoteType, largest to largest
|
||||
{
|
||||
float fBeatSpacing = NoteTypeToBeat( nt );
|
||||
int iRowSpacing = lroundf( fBeatSpacing * ROWS_PER_BEAT );
|
||||
int iRowSpacing = lrintf( fBeatSpacing * ROWS_PER_BEAT );
|
||||
|
||||
bool bFoundSmallerNote = false;
|
||||
// for each index in this measure
|
||||
@@ -340,7 +340,7 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in, RString &sRet )
|
||||
if( nt == NoteType_Invalid )
|
||||
iRowSpacing = 1;
|
||||
else
|
||||
iRowSpacing = lroundf( NoteTypeToBeat(nt) * ROWS_PER_BEAT );
|
||||
iRowSpacing = lrintf( NoteTypeToBeat(nt) * ROWS_PER_BEAT );
|
||||
// (verify first)
|
||||
// iRowSpacing = BeatToNoteRow( NoteTypeToBeat(nt) );
|
||||
|
||||
@@ -1221,7 +1221,7 @@ void NoteDataUtil::Wide( NoteData &inout, int iStartIndex, int iEndIndex )
|
||||
continue; // skip
|
||||
|
||||
// add a note determinitsitcally
|
||||
int iBeat = lroundf( NoteRowToBeat(i) );
|
||||
int iBeat = lrintf( NoteRowToBeat(i) );
|
||||
int iTrackOfNote = inout.GetFirstTrackWithTap(i);
|
||||
int iTrackToAdd = iTrackOfNote + (iBeat%5)-2; // won't be more than 2 tracks away from the existing note
|
||||
CLAMP( iTrackToAdd, 0, inout.GetNumTracks()-1 );
|
||||
|
||||
@@ -21,7 +21,7 @@ void KSFLoader::RemoveHoles( NoteData &out, const Song &song )
|
||||
const int ToRow = (int) BeatToNoteRow(song.m_Timing.m_BPMSegments[seg].m_fStartBeat);
|
||||
|
||||
LOG->Trace("from %f (%i) to (%i)", FromBeat, FromRow, ToRow);
|
||||
// const int ToRow = lroundf(FromRow * song.m_Timing.m_BPMSegments[0].m_fBPM / song.m_BPMSegments[seg].m_fBPM);
|
||||
// const int ToRow = lrintf(FromRow * song.m_Timing.m_BPMSegments[0].m_fBPM / song.m_BPMSegments[seg].m_fBPM);
|
||||
// const int Rows = out.GetLastRow() - FromRow + 1;
|
||||
// int LastRow;
|
||||
// if(seg+1 < song.m_Timing.m_BPMSegments().size())
|
||||
@@ -46,7 +46,7 @@ void KSFLoader::RemoveHoles( NoteData &out, const Song &song )
|
||||
if( tn == TAP_EMPTY )
|
||||
continue;
|
||||
|
||||
const int RealRow = lroundf(row * OrigBPM / CurBPM);
|
||||
const int RealRow = lrintf(row * OrigBPM / CurBPM);
|
||||
if( RealRow == row )
|
||||
continue;
|
||||
LOG->Trace("from %i to %i", row, RealRow);
|
||||
|
||||
@@ -361,7 +361,7 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out )
|
||||
ASSERT( out.m_Timing.m_BPMSegments[0].m_iStartIndex == 0 );
|
||||
f.PutLine( ssprintf("#FILE:%s;", DwiEscape(out.m_sMusicFile).c_str()) );
|
||||
f.PutLine( ssprintf("#BPM:%.3f;", out.m_Timing.m_BPMSegments[0].GetBPM()) );
|
||||
f.PutLine( ssprintf("#GAP:%ld;", -lroundf( out.m_Timing.m_fBeat0OffsetInSeconds*1000 )) );
|
||||
f.PutLine( ssprintf("#GAP:%ld;", -lrintf( out.m_Timing.m_fBeat0OffsetInSeconds*1000 )) );
|
||||
f.PutLine( ssprintf("#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds) );
|
||||
f.PutLine( ssprintf("#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds) );
|
||||
if( out.m_sCDTitleFile.size() )
|
||||
|
||||
@@ -704,9 +704,9 @@ void OptionRow::GetWidthXY( PlayerNumber pn, int iChoiceOnRow, int &iWidthOut, i
|
||||
{
|
||||
const BitmapText &text = GetTextItemForRow( pn, iChoiceOnRow );
|
||||
|
||||
iWidthOut = lroundf( text.GetZoomedWidth() );
|
||||
iXOut = lroundf( text.GetDestX() );
|
||||
iYOut = lroundf( m_Frame.GetDestY() );
|
||||
iWidthOut = lrintf( text.GetZoomedWidth() );
|
||||
iXOut = lrintf( text.GetDestX() );
|
||||
iYOut = lrintf( m_Frame.GetDestY() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ static void AddPart( vector<RString> &AddTo, float level, RString name )
|
||||
if( level == 0 )
|
||||
return;
|
||||
|
||||
const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lroundf(level*100) );
|
||||
const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lrintf(level*100) );
|
||||
|
||||
AddTo.push_back( LevelStr + name );
|
||||
}
|
||||
|
||||
@@ -528,10 +528,10 @@ static void CheckReversePackedPixels()
|
||||
void SetupExtensions()
|
||||
{
|
||||
const float fGLVersion = StringToFloat( (const char *) glGetString(GL_VERSION) );
|
||||
g_glVersion = lroundf( fGLVersion * 10 );
|
||||
g_glVersion = lrintf( fGLVersion * 10 );
|
||||
|
||||
const float fGLUVersion = StringToFloat( (const char *) gluGetString(GLU_VERSION) );
|
||||
g_gluVersion = lroundf( fGLUVersion * 10 );
|
||||
g_gluVersion = lrintf( fGLUVersion * 10 );
|
||||
|
||||
GLExt.Load( g_pWind );
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ void GLExt_t::Load( LowLevelWindow *pWind )
|
||||
else
|
||||
{
|
||||
const float fVersion = StringToFloat( pzVersion );
|
||||
m_iShadingLanguageVersion = lroundf( fVersion * 100 );
|
||||
m_iShadingLanguageVersion = lrintf( fVersion * 100 );
|
||||
/* The version string may contain extra information beyond the version number. */
|
||||
LOG->Info( "OpenGL shading language: %s", pzVersion );
|
||||
}
|
||||
|
||||
@@ -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( lroundf(I * (255.0f / (Ivalues-1))), 0L, 255L );
|
||||
ScaledI = clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L );
|
||||
|
||||
int ScaledA;
|
||||
if( Avalues == 1 )
|
||||
ScaledA = 255; // if only one alpha value, always opaque
|
||||
else
|
||||
ScaledA = clamp( lroundf(A * (255.0f / (Avalues-1))), 0L, 255L );
|
||||
ScaledA = clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L );
|
||||
|
||||
RageSurfaceColor c;
|
||||
c.r = uint8_t(ScaledI);
|
||||
|
||||
@@ -559,8 +559,8 @@ void ScreenEvaluation::Init()
|
||||
RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines, RadarCategory_Hands, RadarCategory_Rolls
|
||||
};
|
||||
const int ind = indeces[l];
|
||||
const int iActual = lroundf(STATSMAN->m_CurStageStats.m_player[p].m_radarActual[ind]);
|
||||
const int iPossible = lroundf(STATSMAN->m_CurStageStats.m_player[p].m_radarPossible[ind]);
|
||||
const int iActual = lrintf(STATSMAN->m_CurStageStats.m_player[p].m_radarActual[ind]);
|
||||
const int iPossible = lrintf(STATSMAN->m_CurStageStats.m_player[p].m_radarPossible[ind]);
|
||||
|
||||
m_textStatsText[l][p].SetText( ssprintf("%3d/%3d",iActual,iPossible) );
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void ScreenNameEntry::ScrollingText::Init( const RString &sName, const vector<fl
|
||||
void ScreenNameEntry::ScrollingText::DrawPrimitives()
|
||||
{
|
||||
const float fFakeBeat = GAMESTATE->m_fSongBeat;
|
||||
const size_t iClosestIndex = lroundf( fFakeBeat ) % g_sNameChars.size();
|
||||
const size_t iClosestIndex = lrintf( fFakeBeat ) % g_sNameChars.size();
|
||||
const float fClosestYOffset = GetClosestCharYOffset( fFakeBeat );
|
||||
|
||||
size_t iCharIndex = ( iClosestIndex - NUM_CHARS_TO_DRAW_BEHIND + g_sNameChars.size() ) % g_sNameChars.size();
|
||||
@@ -103,7 +103,7 @@ void ScreenNameEntry::ScrollingText::DrawPrimitives()
|
||||
char ScreenNameEntry::ScrollingText::GetClosestChar( float fFakeBeat ) const
|
||||
{
|
||||
ASSERT( fFakeBeat >= 0.f );
|
||||
return g_sNameChars[lroundf(fFakeBeat) % g_sNameChars.size()];
|
||||
return g_sNameChars[lrintf(fFakeBeat) % g_sNameChars.size()];
|
||||
}
|
||||
|
||||
// return value is relative to gray arrows
|
||||
|
||||
@@ -43,7 +43,7 @@ static void AddPart( vector<RString> &AddTo, float level, RString name )
|
||||
if( level == 0 )
|
||||
return;
|
||||
|
||||
const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lroundf(level*100) );
|
||||
const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lrintf(level*100) );
|
||||
|
||||
AddTo.push_back( LevelStr + name );
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ int Trail::GetMeter() const
|
||||
|
||||
float fMeter = GetTotalMeter() / (float)m_vEntries.size();
|
||||
|
||||
return lroundf( fMeter );
|
||||
return lrintf( fMeter );
|
||||
}
|
||||
|
||||
int Trail::GetTotalMeter() const
|
||||
|
||||
@@ -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 = lroundf( fMeter );
|
||||
iMeter = lrintf( fMeter );
|
||||
}
|
||||
break;
|
||||
case WorkoutProgram_FitnessTest:
|
||||
@@ -92,7 +92,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
iMeter = lroundf( SCALE( 0.5f, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter ) );
|
||||
iMeter = lrintf( 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 = lroundf( fMeter );
|
||||
iMeter = lrintf( fMeter );
|
||||
}
|
||||
break;
|
||||
case WorkoutProgram_Flat:
|
||||
|
||||
@@ -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( lroundf(prec * 63) ) };
|
||||
thread_precedence_policy po = { integer_t( lrintf(prec * 63) ) };
|
||||
kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY,
|
||||
(thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT );
|
||||
|
||||
|
||||
@@ -208,11 +208,6 @@ inline float roundf( float f ) CONST_FUNCTION;
|
||||
float roundf( float f ) { if( f < 0.0f ) return truncf( f-0.5f ); return truncf( f+0.5f ); }
|
||||
#endif
|
||||
|
||||
#ifdef NEED_LROUNDF
|
||||
inline long int lroundf( float f ) CONST_FUNCTION;
|
||||
long int lroundf( float f ) { return (long int)roundf( f ); }
|
||||
#endif
|
||||
|
||||
#ifdef NEED_STRTOF
|
||||
inline float strtof( const char *s, char **se ) { return (float) strtod( s, se ); }
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user