Revert "Make wrap a template to avoid type-punning"
authorCarl Myers <cmyers@cmyers.org>
Wed, 4 Apr 2012 03:53:35 +0000 (20:53 -0700)
committerCarl Myers <cmyers@cmyers.org>
Wed, 4 Apr 2012 03:53:35 +0000 (20:53 -0700)
This reverts commit 334f1f865fde7123608a4c7363e33424464273d6.

src/RageUtil.h
src/ScreenTextEntry.cpp

index 0b410d9..58e60e8 100755 (executable)
@@ -56,14 +56,11 @@ inline bool CLAMP(float &x, float l, float h)
        return false;
 }
 
-template<typename T>
-inline void wrap( T &x, int n )
+inline void wrap( int &x, int n )
 {
-       int xi = x;
-       if (xi<0)
-               xi += ((-xi/n)+1)*n;
-       xi %= n;
-       x = static_cast<T>(xi);
+       if (x<0)
+               x += ((-x/n)+1)*n;
+       x %= n;
 }
 inline void wrap( unsigned &x, unsigned n )
 {
index 83352d0..ce12642 100755 (executable)
@@ -289,7 +289,7 @@ void ScreenTextEntry::MoveY( int iDir )
        do
        {
                m_iFocusY = (KeyboardRow)(m_iFocusY + iDir);
-               wrap( m_iFocusY, NUM_KEYBOARD_ROWS );
+               wrap( (int&)m_iFocusY, NUM_KEYBOARD_ROWS );
 
                // HACK: Round to nearest option so that we always stop 
                // on KEYBOARD_ROW_SPECIAL.