43 lines
724 B
C++
43 lines
724 B
C++
#ifndef __AMSCUMATH_IMPL_HPP__
|
|
#define __AMSCUMATH_IMPL_HPP__
|
|
|
|
namespace amscuda
|
|
{
|
|
|
|
template<typename T> __host__ __device__ T min(T a, T b)
|
|
{
|
|
if(a>b)
|
|
{
|
|
return b;
|
|
}
|
|
else
|
|
{
|
|
return a;
|
|
}
|
|
return a;
|
|
}
|
|
|
|
template<typename T> __host__ __device__ T max(T a, T b)
|
|
{
|
|
if(a>b)
|
|
{
|
|
return a;
|
|
}
|
|
else
|
|
{
|
|
return b;
|
|
}
|
|
return a;
|
|
}
|
|
|
|
template<> __host__ __device__ double min(double a, double b);
|
|
template<> __host__ __device__ float min(float a, float b);
|
|
template<> __host__ __device__ double max(double a, double b);
|
|
template<> __host__ __device__ float max(float a, float b);
|
|
|
|
|
|
}; //end namespace amscuda
|
|
|
|
#endif
|
|
|