Flow Visualisation
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  GLM_FUNC_DECL float toFloat32(hdata value);
40  GLM_FUNC_DECL hdata toFloat16(float const & value);
41 
42  class half
43  {
44  public:
45  // Constructors
47  GLM_FUNC_DECL half(half const & s);
48 
49  template <typename U>
50  GLM_FUNC_DECL explicit half(U const & s);
51 
52  // Cast
53  //template <typename U>
54  //GLM_FUNC_DECL operator U() const;
55  GLM_FUNC_DECL operator float() const;
56 
57  // Unary updatable operators
58  GLM_FUNC_DECL half& operator= (half const & s);
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++();
64  GLM_FUNC_DECL half& operator--();
65 
66  GLM_FUNC_DECL float toFloat() const{return toFloat32(data);}
67 
68  GLM_FUNC_DECL hdata _data() const{return data;}
69 
70  private:
71  hdata data;
72  };
73 
74  GLM_FUNC_DECL half operator+ (half const & s1, half const & s2);
75 
76  GLM_FUNC_DECL half operator- (half const & s1, half const & s2);
77 
78  GLM_FUNC_DECL half operator* (half const & s1, half const & s2);
79 
80  GLM_FUNC_DECL half operator/ (half const & s1, half const & s2);
81 
82  // Unary constant operators
83  GLM_FUNC_DECL half operator- (half const & s);
84 
85  GLM_FUNC_DECL half operator-- (half const & s, int);
86 
87  GLM_FUNC_DECL half operator++ (half const & s, int);
88 
90  detail::half const & x,
91  detail::half const & y);
92 
94  detail::half const & x,
95  detail::half const & y);
96 
98  detail::half const & x,
99  detail::half const & y);
100 
102  detail::half const & x,
103  detail::half const & y);
104 
106  detail::half const & x,
107  detail::half const & y);
108 
110  detail::half const & x,
111  detail::half const & y);
112 
113 }//namespace detail
114 }//namespace glm
115 
116 #include "type_half.inl"
117 
118 #endif//glm_core_type_half
GLM_FUNC_DECL half & operator*=(half const &s)
Definition: type_half.inl:301
GLM_FUNC_DECL float toFloat() const
Definition: type_half.hpp:66
GLM_FUNC_DECL half operator--(half const &s, int)
Definition: type_half.inl:356
GLM_FUNC_DECL half & operator/=(half const &s)
Definition: type_half.inl:307
Definition: _detail.hpp:38
GLM_FUNC_DECL bool operator<(detail::half const &x, detail::half const &y)
Definition: type_half.inl:385
GLM_FUNC_DECL bool operator<=(detail::half const &x, detail::half const &y)
Definition: type_half.inl:394
GLM_FUNC_DECL bool operator>=(detail::half const &x, detail::half const &y)
Definition: type_half.inl:412
GLM_FUNC_DECL bool operator==(detail::half const &x, detail::half const &y)
Definition: type_half.inl:367
GLM_FUNC_DECL half()
Definition: type_half.inl:257
GLM_FUNC_DECL float toFloat32(hdata value)
Definition: type_half.inl:48
GLM_FUNC_DECL half operator+(half const &s1, half const &s2)
Definition: type_half.inl:330
short hdata
Definition: type_half.hpp:37
GLM_FUNC_DECL half operator-(half const &s1, half const &s2)
Definition: type_half.inl:335
GLM_FUNC_DECL half operator++(half const &s, int)
Definition: type_half.inl:361
GLM_FUNC_DECL bool operator!=(detail::half const &x, detail::half const &y)
Definition: type_half.inl:376
GLM_FUNC_DECL half & operator=(half const &s)
Definition: type_half.inl:283
GLM_FUNC_DECL half & operator-=(half const &s)
Definition: type_half.inl:295
Definition: type_half.hpp:42
GLM_FUNC_DECL half operator*(half const &s1, half const &s2)
Definition: type_half.inl:340
GLM_FUNC_DECL half & operator++()
Definition: type_half.inl:313
GLM_FUNC_DECL hdata _data() const
Definition: type_half.hpp:68
GLM_FUNC_DECL hdata toFloat16(float const &value)
Definition: type_half.inl:122
GLM_FUNC_DECL half & operator--()
Definition: type_half.inl:320
GLM_FUNC_DECL bool operator>(detail::half const &x, detail::half const &y)
Definition: type_half.inl:403
GLM_FUNC_DECL half operator/(half const &s1, half const &s2)
Definition: type_half.inl:345
GLM_FUNC_DECL half & operator+=(half const &s)
Definition: type_half.inl:289
#define GLM_FUNC_DECL
Definition: setup.hpp:678