From e659cbdd058fe197a2a5ead4038a591c75063331 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 1 Jun 2020 22:46:17 -0700 Subject: [PATCH] Resolve more conflicts with std::swap. --- mathlib/mathlib_base.cpp | 18 +++++++++--------- public/mathlib/math_base.h | 2 +- public/tier1/utlmemory.h | 6 +++--- public/tier1/utlvector.h | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mathlib/mathlib_base.cpp b/mathlib/mathlib_base.cpp index 9da47149..fb3f90ad 100644 --- a/mathlib/mathlib_base.cpp +++ b/mathlib/mathlib_base.cpp @@ -1658,9 +1658,9 @@ void MatrixInvert( const matrix3x4_t& in, matrix3x4_t& out ) Assert( s_bMathlibInitialized ); if ( &in == &out ) { - swap(out[0][1],out[1][0]); - swap(out[0][2],out[2][0]); - swap(out[1][2],out[2][1]); + V_swap(out[0][1],out[1][0]); + V_swap(out[0][2],out[2][0]); + V_swap(out[1][2],out[2][1]); } else { @@ -3282,18 +3282,18 @@ bool SolveInverseQuadraticMonotonic( float x1, float y1, float x2, float y2, flo // first, sort parameters if (x1>x2) { - swap(x1,x2); - swap(y1,y2); + V_swap(x1,x2); + V_swap(y1,y2); } if (x2>x3) { - swap(x2,x3); - swap(y2,y3); + V_swap(x2,x3); + V_swap(y2,y3); } if (x1>x2) { - swap(x1,x2); - swap(y1,y2); + V_swap(x1,x2); + V_swap(y1,y2); } // this code is not fast. what it does is when the curve would be non-monotonic, slowly shifts // the center point closer to the linear line between the endpoints. Should anyone need htis diff --git a/public/mathlib/math_base.h b/public/mathlib/math_base.h index 59a3e38e..d4356d50 100644 --- a/public/mathlib/math_base.h +++ b/public/mathlib/math_base.h @@ -581,7 +581,7 @@ template<> FORCEINLINE_TEMPLATE QAngleByValue Lerp( float flPerce // Swap two of anything. template -FORCEINLINE_TEMPLATE void swap( T& x, T& y ) +FORCEINLINE_TEMPLATE void V_swap( T& x, T& y ) { T temp = x; x = y; diff --git a/public/tier1/utlmemory.h b/public/tier1/utlmemory.h index d1641aec..1222a388 100644 --- a/public/tier1/utlmemory.h +++ b/public/tier1/utlmemory.h @@ -228,9 +228,9 @@ CUtlMemory::~CUtlMemory() template< class T > void CUtlMemory::Swap( CUtlMemory< T > &mem ) { - swap( m_nGrowSize, mem.m_nGrowSize ); - swap( m_pMemory, mem.m_pMemory ); - swap( m_nAllocationCount, mem.m_nAllocationCount ); + V_swap( m_nGrowSize, mem.m_nGrowSize ); + V_swap( m_pMemory, mem.m_pMemory ); + V_swap( m_nAllocationCount, mem.m_nAllocationCount ); } diff --git a/public/tier1/utlvector.h b/public/tier1/utlvector.h index 69ed0d64..6866008b 100644 --- a/public/tier1/utlvector.h +++ b/public/tier1/utlvector.h @@ -508,8 +508,8 @@ template< typename T, class A > void CUtlVector::Swap( CUtlVector< T, A > &vec ) { m_Memory.Swap( vec.m_Memory ); - swap( m_Size, vec.m_Size ); - swap( m_pElements, vec.m_pElements ); + V_swap( m_Size, vec.m_Size ); + V_swap( m_pElements, vec.m_pElements ); } template< typename T, class A >