FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
utils_helpers.h
Go to the documentation of this file.
1 #ifndef BITS_MATH_UTILS_HELPERS_H
2 # define BITS_MATH_UTILS_HELPERS_H
3 
4 // Requires at least Visual C++ 2010
5 //# include <cstdint>
6 
7 namespace math {
8 
10 namespace __impl
11 {
12 template<typename T>
13 class TypeTraits
14 {
15 public:
16  typedef int IntegralType_t;
17 
18  static bool isNativeIntegralType()
19  {
20  return true;
21  }
22 
23  static IntegralType_t twoComplementValue()
24  {
25  // Default value, always wrong (just to make the compiler happy)
26  return 0x1;
27  }
28 }; // class TypeTraits
29 /*
30 template<>
31 class TypeTraits<float>
32 {
33 public:
34  typedef std::int32_t IntegralType_t;
35 
36  static IntegralType_t twoComplementValue()
37  {
38  return 0x80000000;
39  }
40 
41  static IntegralType_t maxDistIntsUpperBound()
42  {
43  return 4 * 1024 * 1024;
44  }
45 
46  static bool isNativeIntegralType()
47  {
48  return false;
49  }
50 }; // class TypeTraits<float>
51 
52 template<>
53 class TypeTraits<double>
54 {
55 public:
56  typedef std::int64_t IntegralType_t;
57 
58  static IntegralType_t twoComplementValue()
59  {
60  return INT64_C(0x8000000000000000);
61  }
62 
63  static IntegralType_t maxDistIntsUpperBound()
64  {
65  return 4 * 1024 * 1024;
66  }
67 
68  static bool isNativeIntegralType()
69  {
70  return false;
71  }
72 }; // class TypeTraits<double>
73 */
74 } // namespace __impl
76 } // namespace math
77 
78 #endif // BITS_MATH_UTILS_HELPERS_H
Definition: consts.h:18