1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "Constants.hpp"
16 
17 #include "Common/Math.hpp"
18 #include "Common/Half.hpp"
19 
20 #include <memory.h>
21 
22 namespace sw
23 {
24 	Constants constants;
25 
Constants()26 	Constants::Constants()
27 	{
28 		static const unsigned int transposeBit0[16] =
29 		{
30 			0x00000000,
31 			0x00000001,
32 			0x00000010,
33 			0x00000011,
34 			0x00000100,
35 			0x00000101,
36 			0x00000110,
37 			0x00000111,
38 			0x00001000,
39 			0x00001001,
40 			0x00001010,
41 			0x00001011,
42 			0x00001100,
43 			0x00001101,
44 			0x00001110,
45 			0x00001111
46 		};
47 
48 		static const unsigned int transposeBit1[16] =
49 		{
50 			0x00000000,
51 			0x00000002,
52 			0x00000020,
53 			0x00000022,
54 			0x00000200,
55 			0x00000202,
56 			0x00000220,
57 			0x00000222,
58 			0x00002000,
59 			0x00002002,
60 			0x00002020,
61 			0x00002022,
62 			0x00002200,
63 			0x00002202,
64 			0x00002220,
65 			0x00002222
66 		};
67 
68 		static const unsigned int transposeBit2[16] =
69 		{
70 			0x00000000,
71 			0x00000004,
72 			0x00000040,
73 			0x00000044,
74 			0x00000400,
75 			0x00000404,
76 			0x00000440,
77 			0x00000444,
78 			0x00004000,
79 			0x00004004,
80 			0x00004040,
81 			0x00004044,
82 			0x00004400,
83 			0x00004404,
84 			0x00004440,
85 			0x00004444
86 		};
87 
88 		memcpy(&this->transposeBit0, transposeBit0, sizeof(transposeBit0));
89 		memcpy(&this->transposeBit1, transposeBit1, sizeof(transposeBit1));
90 		memcpy(&this->transposeBit2, transposeBit2, sizeof(transposeBit2));
91 
92 		static const ushort4 cWeight[17] =
93 		{
94 			{0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF},   // 0xFFFF / 1  = 0xFFFF
95 			{0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF},   // 0xFFFF / 1  = 0xFFFF
96 			{0x8000, 0x8000, 0x8000, 0x8000},   // 0xFFFF / 2  = 0x8000
97 			{0x5555, 0x5555, 0x5555, 0x5555},   // 0xFFFF / 3  = 0x5555
98 			{0x4000, 0x4000, 0x4000, 0x4000},   // 0xFFFF / 4  = 0x4000
99 			{0x3333, 0x3333, 0x3333, 0x3333},   // 0xFFFF / 5  = 0x3333
100 			{0x2AAA, 0x2AAA, 0x2AAA, 0x2AAA},   // 0xFFFF / 6  = 0x2AAA
101 			{0x2492, 0x2492, 0x2492, 0x2492},   // 0xFFFF / 7  = 0x2492
102 			{0x2000, 0x2000, 0x2000, 0x2000},   // 0xFFFF / 8  = 0x2000
103 			{0x1C71, 0x1C71, 0x1C71, 0x1C71},   // 0xFFFF / 9  = 0x1C71
104 			{0x1999, 0x1999, 0x1999, 0x1999},   // 0xFFFF / 10 = 0x1999
105 			{0x1745, 0x1745, 0x1745, 0x1745},   // 0xFFFF / 11 = 0x1745
106 			{0x1555, 0x1555, 0x1555, 0x1555},   // 0xFFFF / 12 = 0x1555
107 			{0x13B1, 0x13B1, 0x13B1, 0x13B1},   // 0xFFFF / 13 = 0x13B1
108 			{0x1249, 0x1249, 0x1249, 0x1249},   // 0xFFFF / 14 = 0x1249
109 			{0x1111, 0x1111, 0x1111, 0x1111},   // 0xFFFF / 15 = 0x1111
110 			{0x1000, 0x1000, 0x1000, 0x1000},   // 0xFFFF / 16 = 0x1000
111 		};
112 
113 		static const float4 uvWeight[17] =
114 		{
115 			{1.0f / 1.0f,  1.0f / 1.0f,  1.0f / 1.0f,  1.0f / 1.0f},
116 			{1.0f / 1.0f,  1.0f / 1.0f,  1.0f / 1.0f,  1.0f / 1.0f},
117 			{1.0f / 2.0f,  1.0f / 2.0f,  1.0f / 2.0f,  1.0f / 2.0f},
118 			{1.0f / 3.0f,  1.0f / 3.0f,  1.0f / 3.0f,  1.0f / 3.0f},
119 			{1.0f / 4.0f,  1.0f / 4.0f,  1.0f / 4.0f,  1.0f / 4.0f},
120 			{1.0f / 5.0f,  1.0f / 5.0f,  1.0f / 5.0f,  1.0f / 5.0f},
121 			{1.0f / 6.0f,  1.0f / 6.0f,  1.0f / 6.0f,  1.0f / 6.0f},
122 			{1.0f / 7.0f,  1.0f / 7.0f,  1.0f / 7.0f,  1.0f / 7.0f},
123 			{1.0f / 8.0f,  1.0f / 8.0f,  1.0f / 8.0f,  1.0f / 8.0f},
124 			{1.0f / 9.0f,  1.0f / 9.0f,  1.0f / 9.0f,  1.0f / 9.0f},
125 			{1.0f / 10.0f, 1.0f / 10.0f, 1.0f / 10.0f, 1.0f / 10.0f},
126 			{1.0f / 11.0f, 1.0f / 11.0f, 1.0f / 11.0f, 1.0f / 11.0f},
127 			{1.0f / 12.0f, 1.0f / 12.0f, 1.0f / 12.0f, 1.0f / 12.0f},
128 			{1.0f / 13.0f, 1.0f / 13.0f, 1.0f / 13.0f, 1.0f / 13.0f},
129 			{1.0f / 14.0f, 1.0f / 14.0f, 1.0f / 14.0f, 1.0f / 14.0f},
130 			{1.0f / 15.0f, 1.0f / 15.0f, 1.0f / 15.0f, 1.0f / 15.0f},
131 			{1.0f / 16.0f, 1.0f / 16.0f, 1.0f / 16.0f, 1.0f / 16.0f},
132 		};
133 
134 		static const float4 uvStart[17] =
135 		{
136 			{-0.0f / 2.0f,   -0.0f / 2.0f,   -0.0f / 2.0f,   -0.0f / 2.0f},
137 			{-0.0f / 2.0f,   -0.0f / 2.0f,   -0.0f / 2.0f,   -0.0f / 2.0f},
138 			{-1.0f / 4.0f,   -1.0f / 4.0f,   -1.0f / 4.0f,   -1.0f / 4.0f},
139 			{-2.0f / 6.0f,   -2.0f / 6.0f,   -2.0f / 6.0f,   -2.0f / 6.0f},
140 			{-3.0f / 8.0f,   -3.0f / 8.0f,   -3.0f / 8.0f,   -3.0f / 8.0f},
141 			{-4.0f / 10.0f,  -4.0f / 10.0f,  -4.0f / 10.0f,  -4.0f / 10.0f},
142 			{-5.0f / 12.0f,  -5.0f / 12.0f,  -5.0f / 12.0f,  -5.0f / 12.0f},
143 			{-6.0f / 14.0f,  -6.0f / 14.0f,  -6.0f / 14.0f,  -6.0f / 14.0f},
144 			{-7.0f / 16.0f,  -7.0f / 16.0f,  -7.0f / 16.0f,  -7.0f / 16.0f},
145 			{-8.0f / 18.0f,  -8.0f / 18.0f,  -8.0f / 18.0f,  -8.0f / 18.0f},
146 			{-9.0f / 20.0f,  -9.0f / 20.0f,  -9.0f / 20.0f,  -9.0f / 20.0f},
147 			{-10.0f / 22.0f, -10.0f / 22.0f, -10.0f / 22.0f, -10.0f / 22.0f},
148 			{-11.0f / 24.0f, -11.0f / 24.0f, -11.0f / 24.0f, -11.0f / 24.0f},
149 			{-12.0f / 26.0f, -12.0f / 26.0f, -12.0f / 26.0f, -12.0f / 26.0f},
150 			{-13.0f / 28.0f, -13.0f / 28.0f, -13.0f / 28.0f, -13.0f / 28.0f},
151 			{-14.0f / 30.0f, -14.0f / 30.0f, -14.0f / 30.0f, -14.0f / 30.0f},
152 			{-15.0f / 32.0f, -15.0f / 32.0f, -15.0f / 32.0f, -15.0f / 32.0f},
153 		};
154 
155 		memcpy(&this->cWeight, cWeight, sizeof(cWeight));
156 		memcpy(&this->uvWeight, uvWeight, sizeof(uvWeight));
157 		memcpy(&this->uvStart, uvStart, sizeof(uvStart));
158 
159 		static const unsigned int occlusionCount[16] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
160 
161 		memcpy(&this->occlusionCount, &occlusionCount, sizeof(occlusionCount));
162 
163 		for(int i = 0; i < 16; i++)
164 		{
165 			maskB4Q[i][0] = -(i >> 0 & 1);
166 			maskB4Q[i][1] = -(i >> 1 & 1);
167 			maskB4Q[i][2] = -(i >> 2 & 1);
168 			maskB4Q[i][3] = -(i >> 3 & 1);
169 			maskB4Q[i][4] = -(i >> 0 & 1);
170 			maskB4Q[i][5] = -(i >> 1 & 1);
171 			maskB4Q[i][6] = -(i >> 2 & 1);
172 			maskB4Q[i][7] = -(i >> 3 & 1);
173 
174 			invMaskB4Q[i][0] = ~-(i >> 0 & 1);
175 			invMaskB4Q[i][1] = ~-(i >> 1 & 1);
176 			invMaskB4Q[i][2] = ~-(i >> 2 & 1);
177 			invMaskB4Q[i][3] = ~-(i >> 3 & 1);
178 			invMaskB4Q[i][4] = ~-(i >> 0 & 1);
179 			invMaskB4Q[i][5] = ~-(i >> 1 & 1);
180 			invMaskB4Q[i][6] = ~-(i >> 2 & 1);
181 			invMaskB4Q[i][7] = ~-(i >> 3 & 1);
182 
183 			maskW4Q[i][0] = -(i >> 0 & 1);
184 			maskW4Q[i][1] = -(i >> 1 & 1);
185 			maskW4Q[i][2] = -(i >> 2 & 1);
186 			maskW4Q[i][3] = -(i >> 3 & 1);
187 
188 			invMaskW4Q[i][0] = ~-(i >> 0 & 1);
189 			invMaskW4Q[i][1] = ~-(i >> 1 & 1);
190 			invMaskW4Q[i][2] = ~-(i >> 2 & 1);
191 			invMaskW4Q[i][3] = ~-(i >> 3 & 1);
192 
193 			maskD4X[i][0] = -(i >> 0 & 1);
194 			maskD4X[i][1] = -(i >> 1 & 1);
195 			maskD4X[i][2] = -(i >> 2 & 1);
196 			maskD4X[i][3] = -(i >> 3 & 1);
197 
198 			invMaskD4X[i][0] = ~-(i >> 0 & 1);
199 			invMaskD4X[i][1] = ~-(i >> 1 & 1);
200 			invMaskD4X[i][2] = ~-(i >> 2 & 1);
201 			invMaskD4X[i][3] = ~-(i >> 3 & 1);
202 
203 			maskQ0Q[i] = -(i >> 0 & 1);
204 			maskQ1Q[i] = -(i >> 1 & 1);
205 			maskQ2Q[i] = -(i >> 2 & 1);
206 			maskQ3Q[i] = -(i >> 3 & 1);
207 
208 			invMaskQ0Q[i] = ~-(i >> 0 & 1);
209 			invMaskQ1Q[i] = ~-(i >> 1 & 1);
210 			invMaskQ2Q[i] = ~-(i >> 2 & 1);
211 			invMaskQ3Q[i] = ~-(i >> 3 & 1);
212 
213 			maskX0X[i][0] = maskX0X[i][1] = maskX0X[i][2] = maskX0X[i][3] = -(i >> 0 & 1);
214 			maskX1X[i][0] = maskX1X[i][1] = maskX1X[i][2] = maskX1X[i][3] = -(i >> 1 & 1);
215 			maskX2X[i][0] = maskX2X[i][1] = maskX2X[i][2] = maskX2X[i][3] = -(i >> 2 & 1);
216 			maskX3X[i][0] = maskX3X[i][1] = maskX3X[i][2] = maskX3X[i][3] = -(i >> 3 & 1);
217 
218 			invMaskX0X[i][0] = invMaskX0X[i][1] = invMaskX0X[i][2] = invMaskX0X[i][3] = ~-(i >> 0 & 1);
219 			invMaskX1X[i][0] = invMaskX1X[i][1] = invMaskX1X[i][2] = invMaskX1X[i][3] = ~-(i >> 1 & 1);
220 			invMaskX2X[i][0] = invMaskX2X[i][1] = invMaskX2X[i][2] = invMaskX2X[i][3] = ~-(i >> 2 & 1);
221 			invMaskX3X[i][0] = invMaskX3X[i][1] = invMaskX3X[i][2] = invMaskX3X[i][3] = ~-(i >> 3 & 1);
222 
223 			maskD01Q[i][0] = -(i >> 0 & 1);
224 			maskD01Q[i][1] = -(i >> 1 & 1);
225 			maskD23Q[i][0] = -(i >> 2 & 1);
226 			maskD23Q[i][1] = -(i >> 3 & 1);
227 
228 			invMaskD01Q[i][0] = ~-(i >> 0 & 1);
229 			invMaskD01Q[i][1] = ~-(i >> 1 & 1);
230 			invMaskD23Q[i][0] = ~-(i >> 2 & 1);
231 			invMaskD23Q[i][1] = ~-(i >> 3 & 1);
232 
233 			maskQ01X[i][0] = -(i >> 0 & 1);
234 			maskQ01X[i][1] = -(i >> 1 & 1);
235 			maskQ23X[i][0] = -(i >> 2 & 1);
236 			maskQ23X[i][1] = -(i >> 3 & 1);
237 
238 			invMaskQ01X[i][0] = ~-(i >> 0 & 1);
239 			invMaskQ01X[i][1] = ~-(i >> 1 & 1);
240 			invMaskQ23X[i][0] = ~-(i >> 2 & 1);
241 			invMaskQ23X[i][1] = ~-(i >> 3 & 1);
242 		}
243 
244 		for(int i = 0; i < 8; i++)
245 		{
246 			mask565Q[i][0] =
247 			mask565Q[i][1] =
248 			mask565Q[i][2] =
249 			mask565Q[i][3] = (i & 0x1 ? 0x001F : 0) | (i & 0x2 ? 0x07E0 : 0) | (i & 0x4 ? 0xF800 : 0);
250 
251 			invMask565Q[i][0] =
252 			invMask565Q[i][1] =
253 			invMask565Q[i][2] =
254 			invMask565Q[i][3] = ~mask565Q[i][0];
255 		}
256 
257 		for(int i = 0; i < 4; i++)
258 		{
259 			maskW01Q[i][0] =  -(i >> 0 & 1);
260 			maskW01Q[i][1] =  -(i >> 1 & 1);
261 			maskW01Q[i][2] =  -(i >> 0 & 1);
262 			maskW01Q[i][3] =  -(i >> 1 & 1);
263 
264 			invMaskW01Q[i][0] =  ~-(i >> 0 & 1);
265 			invMaskW01Q[i][1] =  ~-(i >> 1 & 1);
266 			invMaskW01Q[i][2] =  ~-(i >> 0 & 1);
267 			invMaskW01Q[i][3] =  ~-(i >> 1 & 1);
268 
269 			maskD01X[i][0] =  -(i >> 0 & 1);
270 			maskD01X[i][1] =  -(i >> 1 & 1);
271 			maskD01X[i][2] =  -(i >> 0 & 1);
272 			maskD01X[i][3] =  -(i >> 1 & 1);
273 
274 			invMaskD01X[i][0] =  ~-(i >> 0 & 1);
275 			invMaskD01X[i][1] =  ~-(i >> 1 & 1);
276 			invMaskD01X[i][2] =  ~-(i >> 0 & 1);
277 			invMaskD01X[i][3] =  ~-(i >> 1 & 1);
278 		}
279 
280 		for(int i = 0; i < 256; i++)
281 		{
282 			sRGBtoLinear8_12[i] = (unsigned short)(sw::sRGBtoLinear((float)i / 0xFF) * 0x1000 + 0.5f);
283 		}
284 
285 		for(int i = 0; i < 64; i++)
286 		{
287 			sRGBtoLinear6_12[i] = (unsigned short)(sw::sRGBtoLinear((float)i / 0x3F) * 0x1000 + 0.5f);
288 		}
289 
290 		for(int i = 0; i < 32; i++)
291 		{
292 			sRGBtoLinear5_12[i] = (unsigned short)(sw::sRGBtoLinear((float)i / 0x1F) * 0x1000 + 0.5f);
293 		}
294 
295 		for(int i = 0; i < 0x1000; i++)
296 		{
297 			linearToSRGB12_16[i] = (unsigned short)(clamp(sw::linearToSRGB((float)i / 0x0FFF) * 0xFFFF + 0.5f, 0.0f, (float)0xFFFF));
298 			sRGBtoLinear12_16[i] = (unsigned short)(clamp(sw::sRGBtoLinear((float)i / 0x0FFF) * 0xFFFF + 0.5f, 0.0f, (float)0xFFFF));
299 		}
300 
301 		for(int q = 0; q < 4; q++)
302 		{
303 			for(int c = 0; c < 16; c++)
304 			{
305 				for(int i = 0; i < 4; i++)
306 				{
307 					const float X[4] = {+0.3125f, -0.3125f, -0.1250f, +0.1250f};
308 					const float Y[4] = {+0.1250f, -0.1250f, +0.3125f, -0.3125f};
309 
310 					sampleX[q][c][i] = c & (1 << i) ? X[q] : 0.0f;
311 					sampleY[q][c][i] = c & (1 << i) ? Y[q] : 0.0f;
312 					weight[c][i] = c & (1 << i) ? 1.0f : 0.0f;
313 				}
314 			}
315 		}
316 
317 		const int Xf[4] = {-5, +5, +2, -2};   // Fragment offsets
318 		const int Yf[4] = {-2, +2, -5, +5};   // Fragment offsets
319 
320 		memcpy(&this->Xf, &Xf, sizeof(Xf));
321 		memcpy(&this->Yf, &Yf, sizeof(Yf));
322 
323 		static const float4 X[4] = {{-0.3125f, -0.3125f, -0.3125f, -0.3125f},
324 					                {+0.3125f, +0.3125f, +0.3125f, +0.3125f},
325 					                {+0.1250f, +0.1250f, +0.1250f, +0.1250f},
326 					                {-0.1250f, -0.1250f, -0.1250f, -0.1250f}};
327 
328 		static const float4 Y[4] = {{-0.1250f, -0.1250f, -0.1250f, -0.1250f},
329 		                            {+0.1250f, +0.1250f, +0.1250f, +0.1250f},
330 		                            {-0.3125f, -0.3125f, -0.3125f, -0.3125f},
331 		                            {+0.3125f, +0.3125f, +0.3125f, +0.3125f}};
332 
333 		memcpy(&this->X, &X, sizeof(X));
334 		memcpy(&this->Y, &Y, sizeof(Y));
335 
336 		const dword maxX[16] = {0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101};
337 		const dword maxY[16] = {0x00000000, 0x00000002, 0x00000200, 0x00000202, 0x00020000, 0x00020002, 0x00020200, 0x00020202, 0x02000000, 0x02000002, 0x02000200, 0x02000202, 0x02020000, 0x02020002, 0x02020200, 0x02020202};
338 		const dword maxZ[16] = {0x00000000, 0x00000004, 0x00000400, 0x00000404, 0x00040000, 0x00040004, 0x00040400, 0x00040404, 0x04000000, 0x04000004, 0x04000400, 0x04000404, 0x04040000, 0x04040004, 0x04040400, 0x04040404};
339 		const dword minX[16] = {0x00000000, 0x00000008, 0x00000800, 0x00000808, 0x00080000, 0x00080008, 0x00080800, 0x00080808, 0x08000000, 0x08000008, 0x08000800, 0x08000808, 0x08080000, 0x08080008, 0x08080800, 0x08080808};
340 		const dword minY[16] = {0x00000000, 0x00000010, 0x00001000, 0x00001010, 0x00100000, 0x00100010, 0x00101000, 0x00101010, 0x10000000, 0x10000010, 0x10001000, 0x10001010, 0x10100000, 0x10100010, 0x10101000, 0x10101010};
341 		const dword minZ[16] = {0x00000000, 0x00000020, 0x00002000, 0x00002020, 0x00200000, 0x00200020, 0x00202000, 0x00202020, 0x20000000, 0x20000020, 0x20002000, 0x20002020, 0x20200000, 0x20200020, 0x20202000, 0x20202020};
342 		const dword fini[16] = {0x00000000, 0x00000080, 0x00008000, 0x00008080, 0x00800000, 0x00800080, 0x00808000, 0x00808080, 0x80000000, 0x80000080, 0x80008000, 0x80008080, 0x80800000, 0x80800080, 0x80808000, 0x80808080};
343 
344 		memcpy(&this->maxX, &maxX, sizeof(maxX));
345 		memcpy(&this->maxY, &maxY, sizeof(maxY));
346 		memcpy(&this->maxZ, &maxZ, sizeof(maxZ));
347 		memcpy(&this->minX, &minX, sizeof(minX));
348 		memcpy(&this->minY, &minY, sizeof(minY));
349 		memcpy(&this->minZ, &minZ, sizeof(minZ));
350 		memcpy(&this->fini, &fini, sizeof(fini));
351 
352 		static const dword4 maxPos = {0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFE};
353 
354 		memcpy(&this->maxPos, &maxPos, sizeof(maxPos));
355 
356 		static const float4 unscaleByte = {1.0f / 0xFF, 1.0f / 0xFF, 1.0f / 0xFF, 1.0f / 0xFF};
357 		static const float4 unscaleSByte = {1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F};
358 		static const float4 unscaleShort = {1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF};
359 		static const float4 unscaleUShort = {1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF};
360 		static const float4 unscaleInt = {1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF};
361 		static const float4 unscaleUInt = {1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF};
362 		static const float4 unscaleFixed = {1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000};
363 
364 		memcpy(&this->unscaleByte, &unscaleByte, sizeof(unscaleByte));
365 		memcpy(&this->unscaleSByte, &unscaleSByte, sizeof(unscaleSByte));
366 		memcpy(&this->unscaleShort, &unscaleShort, sizeof(unscaleShort));
367 		memcpy(&this->unscaleUShort, &unscaleUShort, sizeof(unscaleUShort));
368 		memcpy(&this->unscaleInt, &unscaleInt, sizeof(unscaleInt));
369 		memcpy(&this->unscaleUInt, &unscaleUInt, sizeof(unscaleUInt));
370 		memcpy(&this->unscaleFixed, &unscaleFixed, sizeof(unscaleFixed));
371 
372 		for(int i = 0; i <= 0xFFFF; i++)
373 		{
374 			half2float[i] = (float)reinterpret_cast<half&>(i);
375 		}
376 	}
377 }