diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 0b50cd5bb4..dfe42a2d3a 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -25,6 +25,15 @@ unsigned long randseed = time(NULL); +/* Return a positive x mod y. */ +float fmodfp(float x, float y) +{ + x = fmodf(x, y); /* x is [-y,y] */ + x += y; /* x is [0,y*2] */ + x = fmodf(x, y); /* x is [0,y] */ + return x; +} + int power_of_two(int input) { int value = 1; diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 37c4efc3dd..2470d2c86d 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -113,6 +113,9 @@ inline float froundf( const float f, const float fRoundInterval ) return int( (f + fRoundInterval/2)/fRoundInterval ) * fRoundInterval; } +/* Return a positive x mod y. */ +float fmodfp(float x, float y); + int power_of_two(int input); bool IsAnInt( const CString &s ); bool IsHexVal( const CString &s );