1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-21 04:56:01 +08:00

Fix min/max defines conflicting with STL.

This commit is contained in:
David Anderson
2020-05-20 18:10:23 -07:00
parent 19c8684425
commit decce90766
4 changed files with 31 additions and 31 deletions

View File

@ -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 );