Commit 27391ddb authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added specialization of TNL::abs for unsigned types to avoid clang warnings

parent ec89ae36
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ ResultType max( const T1& a, const T2& b )
/**
 * \brief This function returns absolute value of given number \e n.
 */
template< class T >
template< class T,
          std::enable_if_t< ! std::is_unsigned<T>::value, bool > = true >
__cuda_callable__ inline
T abs( const T& n )
{
@@ -95,6 +96,17 @@ T abs( const T& n )
#endif
}

/**
 * \brief This function returns the absolute value of given unsigned number \e n, i.e. \e n.
 */
template< class T,
          std::enable_if_t< std::is_unsigned<T>::value, bool > = true >
__cuda_callable__ inline
T abs( const T& n )
{
   return n;
}

/***
 * \brief This function returns argument of minimum of two numbers.
 */