- 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
56 // Unary updatable operators
57 GLM_FUNC_DECL half& operator= (half const & s);
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++();
63 GLM_FUNC_DECL half& operator--();
64
65 GLM_FUNC_DECL float toFloat() const{return toFloat32(data);}
66
67 GLM_FUNC_DECL hdata _data() const{return data;}
68
69 private:
70 hdata data;
71 };
72
73 half operator+ (half const & s1, half const & s2);
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 // Unary constant operators
82 half operator- (half const & s);
83
84 half operator-- (half const & s, int);
85
86 half operator++ (half const & s, int);
87
88 bool operator==(
89 detail::half const & x,
90 detail::half const & y);
91
92 bool operator!=(
93 detail::half const & x,
94 detail::half const & y);
95
96 bool operator<(
97 detail::half const & x,
98 detail::half const & y);
99
100 bool operator<=(
101 detail::half const & x,
102 detail::half const & y);
103
104 bool operator>(
105 detail::half const & x,
106 detail::half const & y);
107
108 bool operator>=(
109 detail::half const & x,
110 detail::half const & y);
111
112 }//namespace detail
113 }//namespace glm
114
115 #include "type_half.inl"
116
117 #endif//glm_core_type_half