This source file includes following definitions.
- min
- max
- min
- max
- min
- max
- min
- max
- min
- max
- min
- max
- min
- max
- min
- max
- epsilon
- min
- max
- epsilon
#pragma once
#ifndef __OPENCV_CUDEV_UTIL_LIMITS_HPP__
#define __OPENCV_CUDEV_UTIL_LIMITS_HPP__
#include <limits.h>
#include <float.h>
#include "../common.hpp"
namespace cv { namespace cudev {
template <class T> struct numeric_limits;
template <> struct numeric_limits<bool>
{
__device__ __forceinline__ static bool min() { return false; }
__device__ __forceinline__ static bool max() { return true; }
static const bool is_signed = false;
};
template <> struct numeric_limits<schar>
{
__device__ __forceinline__ static schar min() { return SCHAR_MIN; }
__device__ __forceinline__ static schar max() { return SCHAR_MAX; }
static const bool is_signed = true;
};
template <> struct numeric_limits<uchar>
{
__device__ __forceinline__ static uchar min() { return 0; }
__device__ __forceinline__ static uchar max() { return UCHAR_MAX; }
static const bool is_signed = false;
};
template <> struct numeric_limits<short>
{
__device__ __forceinline__ static short min() { return SHRT_MIN; }
__device__ __forceinline__ static short max() { return SHRT_MAX; }
static const bool is_signed = true;
};
template <> struct numeric_limits<ushort>
{
__device__ __forceinline__ static ushort min() { return 0; }
__device__ __forceinline__ static ushort max() { return USHRT_MAX; }
static const bool is_signed = false;
};
template <> struct numeric_limits<int>
{
__device__ __forceinline__ static int min() { return INT_MIN; }
__device__ __forceinline__ static int max() { return INT_MAX; }
static const bool is_signed = true;
};
template <> struct numeric_limits<uint>
{
__device__ __forceinline__ static uint min() { return 0; }
__device__ __forceinline__ static uint max() { return UINT_MAX; }
static const bool is_signed = false;
};
template <> struct numeric_limits<float>
{
__device__ __forceinline__ static float min() { return FLT_MIN; }
__device__ __forceinline__ static float max() { return FLT_MAX; }
__device__ __forceinline__ static float epsilon() { return FLT_EPSILON; }
static const bool is_signed = true;
};
template <> struct numeric_limits<double>
{
__device__ __forceinline__ static double min() { return DBL_MIN; }
__device__ __forceinline__ static double max() { return DBL_MAX; }
__device__ __forceinline__ static double epsilon() { return DBL_EPSILON; }
static const bool is_signed = true;
};
}}
#endif