diff --git a/var/tmp/portage/media-libs/opencv-3.3.0-r4/work/opencv-3.3.0/modules/cudev/include/opencv2/cudev/util/saturate_cast.hpp b/./saturate_cast.hpp index ec9804c..4359d18 100644 --- a/modules/cudev/include/opencv2/cudev/util/saturate_cast.hpp +++ b/modules/cudev/include/opencv2/cudev/util/saturate_cast.hpp @@ -47,6 +47,9 @@ #define OPENCV_CUDEV_UTIL_SATURATE_CAST_HPP #include "../common.hpp" +#if __CUDACC_VER_MAJOR__ >= 9 +#include +#endif namespace cv { namespace cudev { @@ -274,15 +277,25 @@ template __device__ __forceinline__ D cast_fp16(T v); template <> __device__ __forceinline__ float cast_fp16(short v) { +#if __CUDACC_VER_MAJOR__ >= 9 + return float(*(__half*)&v); +#else return __half2float(v); +#endif } template <> __device__ __forceinline__ short cast_fp16(float v) { - return (short)__float2half_rn(v); +#if __CUDACC_VER_MAJOR__ >= 9 + __half h(v); + return *(short*)&v; +#else + return (short)__float2half_rn(v); +#endif } //! @} }} #endif +