diff --git a/modules/cudaarithm/src/cuda/div_scalar.cu b/modules/cudaarithm/src/cuda/div_scalar.cu index d3d2ce03f5..97ada83410 100644 --- a/modules/cudaarithm/src/cuda/div_scalar.cu +++ b/modules/cudaarithm/src/cuda/div_scalar.cu @@ -56,18 +56,16 @@ void divScalar(const GpuMat& src, cv::Scalar val, bool inv, GpuMat& dst, const G namespace { - template struct SafeDiv; - template <> struct SafeDiv<1> + template struct SafeDiv; + template struct SafeDiv { - template __device__ __forceinline__ static T op(T a, T b) { return b != 0 ? a / b : 0; } }; - template <> struct SafeDiv<2> + template struct SafeDiv { - template __device__ __forceinline__ static T op(const T& a, const T& b) { T res; @@ -78,9 +76,8 @@ namespace return res; } }; - template <> struct SafeDiv<3> + template struct SafeDiv { - template __device__ __forceinline__ static T op(const T& a, const T& b) { T res; @@ -92,9 +89,8 @@ namespace return res; } }; - template <> struct SafeDiv<4> + template struct SafeDiv { - template __device__ __forceinline__ static T op(const T& a, const T& b) { T res; @@ -114,7 +110,7 @@ namespace __device__ __forceinline__ DstType operator ()(SrcType a) const { - return saturate_cast(SafeDiv::cn>::op(saturate_cast(a), val)); + return saturate_cast(SafeDiv::cn>::op(saturate_cast(a), val)); } }; @@ -124,7 +120,7 @@ namespace __device__ __forceinline__ DstType operator ()(SrcType a) const { - return saturate_cast(SafeDiv::cn>::op(val, saturate_cast(a))); + return saturate_cast(SafeDiv::cn>::op(val, saturate_cast(a))); } };