PSMoveService
type_half.hpp
Go to the documentation of this file.
1 
29 #ifndef glm_core_type_half
30 #define glm_core_type_half
31 
32 #include <cstdlib>
33 
34 namespace glm{
35 namespace detail
36 {
37  typedef short hdata;
38 
39  float toFloat32(hdata value);
40  hdata toFloat16(float const & value);
41 
44  class half
45  {
46  public:
47  // Constructors
48  GLM_FUNC_DECL half();
49  GLM_FUNC_DECL half(half const & s);
50 
51  template <typename U>
52  GLM_FUNC_DECL explicit half(U const & s);
53 
54  // Cast
55  template <typename U>
56  GLM_FUNC_DECL operator U() const;
57 
58  // Unary updatable operators
59  GLM_FUNC_DECL half& operator= (half const & s);
60  GLM_FUNC_DECL half& operator+=(half const & s);
61  GLM_FUNC_DECL half& operator-=(half const & s);
62  GLM_FUNC_DECL half& operator*=(half const & s);
63  GLM_FUNC_DECL half& operator/=(half const & s);
64  GLM_FUNC_DECL half& operator++();
65  GLM_FUNC_DECL half& operator--();
66 
67  GLM_FUNC_DECL float toFloat() const{return toFloat32(data);}
68 
69  GLM_FUNC_DECL hdata _data() const{return data;}
70 
71  private:
72  hdata data;
73  };
74 
75  half operator+ (half const & s1, half const & s2);
76 
77  half operator- (half const & s1, half const & s2);
78 
79  half operator* (half const & s1, half const & s2);
80 
81  half operator/ (half const & s1, half const & s2);
82 
83  // Unary constant operators
84  half operator- (half const & s);
85 
86  half operator-- (half const & s, int);
87 
88  half operator++ (half const & s, int);
89 
90  bool operator==(
91  detail::half const & x,
92  detail::half const & y);
93 
94  bool operator!=(
95  detail::half const & x,
96  detail::half const & y);
97 
98  bool operator<(
99  detail::half const & x,
100  detail::half const & y);
101 
102  bool operator<=(
103  detail::half const & x,
104  detail::half const & y);
105 
106  bool operator>(
107  detail::half const & x,
108  detail::half const & y);
109 
110  bool operator>=(
111  detail::half const & x,
112  detail::half const & y);
113 
114 }//namespace detail
115 }//namespace glm
116 
117 #include "type_half.inl"
118 
119 #endif//glm_core_type_half
Definition: _detail.hpp:38
OpenGL Mathematics (glm.g-truc.net)
16-bit floating point type.
Definition: type_half.hpp:44