1793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/*M///////////////////////////////////////////////////////////////////////////////////////
2793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
3793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
5793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  By downloading, copying, installing or using the software you agree to this license.
6793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  If you do not agree to this license, do not download, install,
7793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//  copy or use the software.
8793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
9793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
10793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//                           License Agreement
11793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//                For Open Source Computer Vision Library
12793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
13793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Third party copyrights are property of their respective owners.
16793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
17793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// Redistribution and use in source and binary forms, with or without modification,
18793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// are permitted provided that the following conditions are met:
19793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
20793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//   * Redistribution's of source code must retain the above copyright notice,
21793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     this list of conditions and the following disclaimer.
22793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
23793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//   * Redistribution's in binary form must reproduce the above copyright notice,
24793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     this list of conditions and the following disclaimer in the documentation
25793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     and/or other materials provided with the distribution.
26793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
27793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//   * The name of the copyright holders may not be used to endorse or promote products
28793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//     derived from this software without specific prior written permission.
29793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
30793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// This software is provided by the copyright holders and contributors "as is" and
31793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// any express or implied warranties, including, but not limited to, the implied
32793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// warranties of merchantability and fitness for a particular purpose are disclaimed.
33793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// In no event shall the Intel Corporation or contributors be liable for any direct,
34793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// indirect, incidental, special, exemplary, or consequential damages
35793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// (including, but not limited to, procurement of substitute goods or services;
36793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// loss of use, data, or profits; or business interruption) however caused
37793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// and on any theory of liability, whether in contract, strict liability,
38793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// or tort (including negligence or otherwise) arising in any way out of
39793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler// the use of this software, even if advised of the possibility of such damage.
40793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//
41793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//M*/
42793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
43793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#ifndef __OPENCV_CUDA_LIMITS_HPP__
44793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#define __OPENCV_CUDA_LIMITS_HPP__
45793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
46793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#include <limits.h>
47793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#include <float.h>
48793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#include "common.hpp"
49793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
50793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler/** @file
51793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler * @deprecated Use @ref cudev instead.
52793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler */
53793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
54793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//! @cond IGNORED
55793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
56793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslernamespace cv { namespace cuda { namespace device
57793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
58793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <class T> struct numeric_limits;
59793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
60793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<bool>
61793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
62793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static bool min() { return false; }
63793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static bool max() { return true;  }
64793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = false;
65793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
66793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
67793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<signed char>
68793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
69793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static signed char min() { return SCHAR_MIN; }
70793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static signed char max() { return SCHAR_MAX; }
71793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = true;
72793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
73793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
74793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<unsigned char>
75793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
76793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static unsigned char min() { return 0; }
77793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static unsigned char max() { return UCHAR_MAX; }
78793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = false;
79793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
80793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
81793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<short>
82793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
83793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static short min() { return SHRT_MIN; }
84793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static short max() { return SHRT_MAX; }
85793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = true;
86793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
87793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
88793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<unsigned short>
89793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
90793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static unsigned short min() { return 0; }
91793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static unsigned short max() { return USHRT_MAX; }
92793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = false;
93793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
94793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
95793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<int>
96793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
97793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static int min() { return INT_MIN; }
98793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static int max() { return INT_MAX; }
99793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = true;
100793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
101793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
102793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<unsigned int>
103793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
104793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static unsigned int min() { return 0; }
105793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static unsigned int max() { return UINT_MAX; }
106793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = false;
107793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
108793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
109793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<float>
110793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
111793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static float min() { return FLT_MIN; }
112793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static float max() { return FLT_MAX; }
113793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static float epsilon() { return FLT_EPSILON; }
114793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = true;
115793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
116793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
117793ee12c6df9cad3806238d32528c49a3ff9331dNoah Preslertemplate <> struct numeric_limits<double>
118793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler{
119793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static double min() { return DBL_MIN; }
120793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static double max() { return DBL_MAX; }
121793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    __device__ __forceinline__ static double epsilon() { return DBL_EPSILON; }
122793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler    static const bool is_signed = true;
123793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler};
124793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler}}} // namespace cv { namespace cuda { namespace cudev {
125793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
126793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler//! @endcond
127793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler
128793ee12c6df9cad3806238d32528c49a3ff9331dNoah Presler#endif // __OPENCV_CUDA_LIMITS_HPP__
129