Skip to content
Snippets Groups Projects
Commit 19c4c9ea authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Math.h: Added workaround for weird clang error

TODO: check later if it is really necessary
parent a804a923
No related branches found
No related tags found
No related merge requests found
...@@ -27,12 +27,17 @@ template< typename T1, typename T2, typename ResultType = typename std::common_t ...@@ -27,12 +27,17 @@ template< typename T1, typename T2, typename ResultType = typename std::common_t
__cuda_callable__ inline __cuda_callable__ inline
ResultType min( const T1& a, const T2& b ) ResultType min( const T1& a, const T2& b )
{ {
#if defined(__CUDA_ARCH__) #if __cplusplus >= 201402L
// std::min is constexpr since C++14 so it can be reused directly
return std::min( (ResultType) a, (ResultType) b );
#else
#if defined(__CUDA_ARCH__)
return ::min( (ResultType) a, (ResultType) b ); return ::min( (ResultType) a, (ResultType) b );
#elif defined(__MIC__) #elif defined(__MIC__)
return a < b ? a : b; return a < b ? a : b;
#else #else
return std::min( (ResultType) a, (ResultType) b ); return std::min( (ResultType) a, (ResultType) b );
#endif
#endif #endif
} }
...@@ -46,12 +51,17 @@ template< typename T1, typename T2, typename ResultType = typename std::common_t ...@@ -46,12 +51,17 @@ template< typename T1, typename T2, typename ResultType = typename std::common_t
__cuda_callable__ __cuda_callable__
ResultType max( const T1& a, const T2& b ) ResultType max( const T1& a, const T2& b )
{ {
#if defined(__CUDA_ARCH__) #if __cplusplus >= 201402L
// std::max is constexpr since C++14 so it can be reused directly
return std::max( (ResultType) a, (ResultType) b );
#else
#if defined(__CUDA_ARCH__)
return ::max( (ResultType) a, (ResultType) b ); return ::max( (ResultType) a, (ResultType) b );
#elif defined(__MIC__) #elif defined(__MIC__)
return a > b ? a : b; return a > b ? a : b;
#else #else
return std::max( (ResultType) a, (ResultType) b ); return std::max( (ResultType) a, (ResultType) b );
#endif
#endif #endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment