Skip to content

Commit

Permalink
Make Square() a template function instead of macro
Browse files Browse the repository at this point in the history
Missed that one when converting the vector macros, as noticed by freem
  • Loading branch information
slipher committed Jan 27, 2025
1 parent a8a5211 commit 96bd021
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/engine/qcommon/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ inline void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross )
cross[ 2 ] = v1[ 0 ] * v2[ 1 ] - v1[ 1 ] * v2[ 0 ];
}

template<typename A>
A Square( A a )
{
return a * a;
}

template<typename A, typename B, typename C>
void VectorSubtract( const A &a, const B &b, C &&c )
{
Expand Down Expand Up @@ -2222,8 +2228,6 @@ struct fontInfo_t
char name[ MAX_QPATH ];
};

#define Square( x ) ( ( x ) * ( x ) )

// real time
//=============================================

Expand Down

0 comments on commit 96bd021

Please sign in to comment.