- Main Page
- Related Pages
- Modules
- Files

- File List

type_half.hpp
Go to the documentation of this file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
42 class half
43 {
44 public:
45 // Constructors
46 GLM_FUNC_DECL half();
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 half operator+ (half const & s1, half const & s2);
75
76 half operator- (half const & s1, half const & s2);
77
78 half operator* (half const & s1, half const & s2);
79
80 half operator/ (half const & s1, half const & s2);
81
82 // Unary constant operators
83 half operator- (half const & s);
84
85 half operator-- (half const & s, int);
86
87 half operator++ (half const & s, int);
88
89 bool operator==(
90 detail::half const & x,
91 detail::half const & y);
92
93 bool operator!=(
94 detail::half const & x,
95 detail::half const & y);
96
97 bool operator<(
98 detail::half const & x,
99 detail::half const & y);
100
101 bool operator<=(
102 detail::half const & x,
103 detail::half const & y);
104
105 bool operator>(
106 detail::half const & x,
107 detail::half const & y);
108
109 bool operator>=(
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