diff --git a/materialsystem/imaterialsysteminternal.h b/materialsystem/imaterialsysteminternal.h index 40f775d4..34ddc071 100644 --- a/materialsystem/imaterialsysteminternal.h +++ b/materialsystem/imaterialsysteminternal.h @@ -31,9 +31,9 @@ public: { MEM_ALLOC_CREDIT_( "CMatCallQueue.m_Allocator" ); #ifdef SWDS - m_Allocator.Init( 2*1024, 0, 0, 4 ); + m_Allocator.Init( 2*1024, 0, 0, 16 ); #else - m_Allocator.Init( IsX360() ? 2*1024*1024 : 8*1024*1024, 64*1024, 256*1024, 4 ); + m_Allocator.Init( IsX360() ? 2*1024*1024 : 8*1024*1024, 64*1024, 256*1024, 16 ); #endif m_FunctorFactory.SetAllocator( &m_Allocator ); m_pHead = m_pTail = NULL; diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index 2c24ba94..1e8e0266 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -30,7 +30,6 @@ // FP exception clean so this not a turnkey operation. //#define FP_EXCEPTIONS_ENABLED - #ifdef FP_EXCEPTIONS_ENABLED #include // For _clearfp and _controlfp_s #endif @@ -93,37 +92,11 @@ private: FPExceptionEnabler& operator=(const FPExceptionEnabler&); }; - - -#ifdef DEBUG // stop crashing edit-and-continue -FORCEINLINE float clamp( float val, float minVal, float maxVal ) +inline float clamp( const float val, const float minVal, const float maxVal ) { - if ( maxVal < minVal ) - return maxVal; - else if( val < minVal ) - return minVal; - else if( val > maxVal ) - return maxVal; - else - return val; + const float t = val < minVal ? minVal : val; + return t > maxVal ? maxVal : t; } -#else // DEBUG -FORCEINLINE float clamp( float val, float minVal, float maxVal ) -{ -#if defined(__i386__) || defined(_M_IX86) - _mm_store_ss( &val, - _mm_min_ss( - _mm_max_ss( - _mm_load_ss(&val), - _mm_load_ss(&minVal) ), - _mm_load_ss(&maxVal) ) ); -#else - val = fpmax(minVal, val); - val = fpmin(maxVal, val); -#endif - return val; -} -#endif // DEBUG // // Returns a clamped value in the range [min, max]. @@ -131,17 +104,10 @@ FORCEINLINE float clamp( float val, float minVal, float maxVal ) template< class T > inline T clamp( T const &val, T const &minVal, T const &maxVal ) { - if ( maxVal < minVal ) - return maxVal; - else if( val < minVal ) - return minVal; - else if( val > maxVal ) - return maxVal; - else - return val; + const T t = val< minVal ? minVal : val; + return t > maxVal ? maxVal : t; } - // plane_t structure // !!! if this is changed, it must be changed in asm code too !!! // FIXME: does the asm code even exist anymore?