mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-01-04 00:23:25 +08:00
Fix min/max defines conflicting with STL.
This commit is contained in:
parent
acf932ae06
commit
18f01659e9
@ -478,23 +478,23 @@ FORCEINLINE fltx4 ArcTan2SIMD( const fltx4 &a, const fltx4 &b )
|
||||
return result;
|
||||
}
|
||||
|
||||
FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // max(a,b)
|
||||
FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // V_max(a,b)
|
||||
{
|
||||
fltx4 retVal;
|
||||
SubFloat( retVal, 0 ) = max( SubFloat( a, 0 ), SubFloat( b, 0 ) );
|
||||
SubFloat( retVal, 1 ) = max( SubFloat( a, 1 ), SubFloat( b, 1 ) );
|
||||
SubFloat( retVal, 2 ) = max( SubFloat( a, 2 ), SubFloat( b, 2 ) );
|
||||
SubFloat( retVal, 3 ) = max( SubFloat( a, 3 ), SubFloat( b, 3 ) );
|
||||
SubFloat( retVal, 0 ) = V_max( SubFloat( a, 0 ), SubFloat( b, 0 ) );
|
||||
SubFloat( retVal, 1 ) = V_max( SubFloat( a, 1 ), SubFloat( b, 1 ) );
|
||||
SubFloat( retVal, 2 ) = V_max( SubFloat( a, 2 ), SubFloat( b, 2 ) );
|
||||
SubFloat( retVal, 3 ) = V_max( SubFloat( a, 3 ), SubFloat( b, 3 ) );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // min(a,b)
|
||||
FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // V_min(a,b)
|
||||
{
|
||||
fltx4 retVal;
|
||||
SubFloat( retVal, 0 ) = min( SubFloat( a, 0 ), SubFloat( b, 0 ) );
|
||||
SubFloat( retVal, 1 ) = min( SubFloat( a, 1 ), SubFloat( b, 1 ) );
|
||||
SubFloat( retVal, 2 ) = min( SubFloat( a, 2 ), SubFloat( b, 2 ) );
|
||||
SubFloat( retVal, 3 ) = min( SubFloat( a, 3 ), SubFloat( b, 3 ) );
|
||||
SubFloat( retVal, 0 ) = V_min( SubFloat( a, 0 ), SubFloat( b, 0 ) );
|
||||
SubFloat( retVal, 1 ) = V_min( SubFloat( a, 1 ), SubFloat( b, 1 ) );
|
||||
SubFloat( retVal, 2 ) = V_min( SubFloat( a, 2 ), SubFloat( b, 2 ) );
|
||||
SubFloat( retVal, 3 ) = V_min( SubFloat( a, 3 ), SubFloat( b, 3 ) );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@ -945,7 +945,7 @@ FORCEINLINE void TransposeSIMD( fltx4 & x, fltx4 & y, fltx4 & z, fltx4 & w )
|
||||
// and replicate it to the whole return value.
|
||||
FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 & a )
|
||||
{
|
||||
float lowest = min( min( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2));
|
||||
float lowest = V_min( V_min( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2));
|
||||
return ReplicateX4(lowest);
|
||||
}
|
||||
|
||||
@ -953,7 +953,7 @@ FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 & a )
|
||||
// and replicate it to the whole return value.
|
||||
FORCEINLINE fltx4 FindHighestSIMD3( const fltx4 & a )
|
||||
{
|
||||
float highest = max( max( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2));
|
||||
float highest = V_max( V_max( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2));
|
||||
return ReplicateX4(highest);
|
||||
}
|
||||
|
||||
@ -1167,12 +1167,12 @@ FORCEINLINE fltx4 ArcTan2SIMD( const fltx4 &a, const fltx4 &b )
|
||||
|
||||
// DivSIMD defined further down, since it uses ReciprocalSIMD
|
||||
|
||||
FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // max(a,b)
|
||||
FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // V_max(a,b)
|
||||
{
|
||||
return __vmaxfp( a, b );
|
||||
}
|
||||
|
||||
FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // min(a,b)
|
||||
FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // V_min(a,b)
|
||||
{
|
||||
return __vminfp( a, b );
|
||||
}
|
||||
@ -1938,11 +1938,11 @@ FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 & a )
|
||||
compareOne = __vrlimi( compareOne, a, 8 | 4 , 1 );
|
||||
// compareOne is [y,z,G,G]
|
||||
fltx4 retval = MinSIMD( a, compareOne );
|
||||
// retVal is [min(x,y), min(y,z), G, G]
|
||||
// retVal is [min(x,y), V_min(y,z), G, G]
|
||||
compareOne = __vrlimi( compareOne, a, 8 , 2);
|
||||
// compareOne is [z, G, G, G]
|
||||
retval = MinSIMD( retval, compareOne );
|
||||
// retVal = [ min(min(x,y),z), G, G, G ]
|
||||
// retVal = [ V_min(min(x,y),z), G, G, G ]
|
||||
|
||||
// splat the x component out to the whole vector and return
|
||||
return SplatXSIMD( retval );
|
||||
@ -1962,11 +1962,11 @@ FORCEINLINE fltx4 FindHighestSIMD3( const fltx4 & a )
|
||||
compareOne = __vrlimi( compareOne, a, 8 | 4 , 1 );
|
||||
// compareOne is [y,z,G,G]
|
||||
fltx4 retval = MaxSIMD( a, compareOne );
|
||||
// retVal is [max(x,y), max(y,z), G, G]
|
||||
// retVal is [max(x,y), V_max(y,z), G, G]
|
||||
compareOne = __vrlimi( compareOne, a, 8 , 2);
|
||||
// compareOne is [z, G, G, G]
|
||||
retval = MaxSIMD( retval, compareOne );
|
||||
// retVal = [ max(max(x,y),z), G, G, G ]
|
||||
// retVal = [ V_max(max(x,y),z), G, G, G ]
|
||||
|
||||
// splat the x component out to the whole vector and return
|
||||
return SplatXSIMD( retval );
|
||||
@ -2596,12 +2596,12 @@ FORCEINLINE fltx4 CmpInBoundsSIMD( const fltx4 & a, const fltx4 & b ) // (a <=
|
||||
return AndSIMD( CmpLeSIMD(a,b), CmpGeSIMD(a, NegSIMD(b)) );
|
||||
}
|
||||
|
||||
FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // min(a,b)
|
||||
FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // V_min(a,b)
|
||||
{
|
||||
return _mm_min_ps( a, b );
|
||||
}
|
||||
|
||||
FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // max(a,b)
|
||||
FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // V_max(a,b)
|
||||
{
|
||||
return _mm_max_ps( a, b );
|
||||
}
|
||||
@ -2756,7 +2756,7 @@ FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 &a )
|
||||
compareOne = RotateLeft2( a );
|
||||
// compareOne is [z, G, x, y]
|
||||
retval = MinSIMD( retval, compareOne );
|
||||
// retVal = [ min(min(x,y),z)..]
|
||||
// retVal = [ V_min(min(x,y),z)..]
|
||||
// splat the x component out to the whole vector and return
|
||||
return SplatXSIMD( retval );
|
||||
|
||||
@ -2773,7 +2773,7 @@ FORCEINLINE fltx4 FindHighestSIMD3( const fltx4 &a )
|
||||
compareOne = RotateLeft2( a );
|
||||
// compareOne is [z, G, x, y]
|
||||
retval = MaxSIMD( retval, compareOne );
|
||||
// retVal = [ max(max(x,y),z)..]
|
||||
// retVal = [ V_max(max(x,y),z)..]
|
||||
// splat the x component out to the whole vector and return
|
||||
return SplatXSIMD( retval );
|
||||
|
||||
|
@ -9,11 +9,11 @@
|
||||
#ifndef MINMAX_H
|
||||
#define MINMAX_H
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef V_min
|
||||
#define V_min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef V_max
|
||||
#define V_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#endif // MINMAX_H
|
||||
|
@ -123,12 +123,12 @@ inline CTimingInfo< T > CalcSmoothAverage_Struct( const T &value, int nTimes, co
|
||||
{
|
||||
if ( i != newValueIndex )
|
||||
{
|
||||
info.m_HighAverage = max( pInfo->m_Values[i].m_Average, info.m_HighAverage );
|
||||
info.m_LowAverage = min( pInfo->m_Values[i].m_Average, info.m_LowAverage );
|
||||
info.m_HighAverage = V_max( pInfo->m_Values[i].m_Average, info.m_HighAverage );
|
||||
info.m_LowAverage = V_min( pInfo->m_Values[i].m_Average, info.m_LowAverage );
|
||||
}
|
||||
|
||||
info.m_HighValue = max( pInfo->m_Values[i].m_Value, info.m_HighValue );
|
||||
info.m_LowValue = min( pInfo->m_Values[i].m_Value, info.m_LowValue );
|
||||
info.m_HighValue = V_max( pInfo->m_Values[i].m_Value, info.m_HighValue );
|
||||
info.m_LowValue = V_min( pInfo->m_Values[i].m_Value, info.m_LowValue );
|
||||
|
||||
info.m_AverageValue += pInfo->m_Values[i].m_Value;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ protected:
|
||||
const int MAX_GROW = 128;
|
||||
if ( m_nGrowSize * sizeof(T) > MAX_GROW )
|
||||
{
|
||||
m_nGrowSize = max( 1, MAX_GROW / sizeof(T) );
|
||||
m_nGrowSize = V_max( 1, MAX_GROW / sizeof(T) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user