]> git.cworth.org Git - apitrace/blob - thirdparty/directxtex/XNAMath/xnamath.h
thirdparty/directxtex: Import DirectXTex library.
[apitrace] / thirdparty / directxtex / XNAMath / xnamath.h
1 /************************************************************************
2 *                                                                       *
3 * XNAMath.h -- SIMD C++ Math library for Windows and Xbox 360           *
4 *                                                                       *
5 * Copyright (c) Microsoft Corp. All rights reserved.                    *
6 *                                                                       *
7 ************************************************************************/
8
9 #if defined(_MSC_VER) && (_MSC_VER > 1000)
10 #pragma once
11 #endif
12
13 #ifndef __XNAMATH_H__
14 #define __XNAMATH_H__
15
16 #ifdef __XBOXMATH_H__
17 #error XNAMATH and XBOXMATH are incompatible in the same compilation module. Use one or the other.
18 #endif
19
20 #define XNAMATH_VERSION 205
21
22 #if !defined(_XM_X64_) && !defined(_XM_X86_)
23 #if defined(_M_AMD64) || defined(_AMD64_)
24 #define _XM_X64_
25 #elif defined(_M_IX86) || defined(_X86_)
26 #define _XM_X86_
27 #endif
28 #endif
29
30
31 #if !defined(_XM_BIGENDIAN_) && !defined(_XM_LITTLEENDIAN_)
32 #if defined(_XM_X64_) || defined(_XM_X86_)
33 #define _XM_LITTLEENDIAN_
34 #elif defined(_XBOX_VER)
35 #define _XM_BIGENDIAN_
36 #else
37 #error xnamath.h does not support this target
38 #endif
39 #endif
40
41 #if defined(_XM_X86_) || defined(_XM_X64_)
42 #define _XM_SSE_INTRINSICS_
43 #if !defined(__cplusplus) && !defined(_XM_NO_INTRINSICS_)
44 #error xnamath.h only supports C compliation for Xbox 360 targets and no intrinsics cases for x86/x64
45 #endif
46 #elif defined(_XBOX_VER)
47 #if !defined(__VMX128_SUPPORTED) && !defined(_XM_NO_INTRINSICS_)
48 #error xnamath.h requires VMX128 compiler support for XBOX 360
49 #endif // !__VMX128_SUPPORTED && !_XM_NO_INTRINSICS_
50 #define _XM_VMX128_INTRINSICS_
51 #elif !defined(_XM_NO_INTRINSICS_)
52 #error xnamath.h does not support this target
53 #endif
54
55
56 #if defined(_XM_SSE_INTRINSICS_)
57 #ifndef _XM_NO_INTRINSICS_
58 #include <xmmintrin.h>
59 #include <emmintrin.h>
60 #endif
61 #elif defined(_XM_VMX128_INTRINSICS_)
62 #error This version of xnamath.h does not support Xbox 360
63 #endif
64
65 #if defined(_XM_SSE_INTRINSICS_)
66 #pragma warning(push)
67 #pragma warning(disable:4985)
68 #endif
69 #include <math.h>
70 #if defined(_XM_SSE_INTRINSICS_)
71 #pragma warning(pop)
72 #endif
73
74
75 #include <sal.h>
76
77
78 #if !defined(XMINLINE)
79 #if !defined(XM_NO_MISALIGNED_VECTOR_ACCESS)
80 #define XMINLINE __inline
81 #else
82 #define XMINLINE __forceinline
83 #endif
84 #endif
85
86 #if !defined(XMFINLINE)
87 #define XMFINLINE __forceinline
88 #endif
89
90 #if !defined(XMDEBUG)
91 #if defined(_DEBUG)
92 #define XMDEBUG
93 #endif
94 #endif // !XMDEBUG
95
96 #if !defined(XMASSERT)
97 #if defined(_PREFAST_)
98 #define XMASSERT(Expression) __analysis_assume((Expression))
99 #elif defined(XMDEBUG) // !_PREFAST_
100 #define XMASSERT(Expression) ((VOID)((Expression) || (XMAssert(#Expression, __FILE__, __LINE__), 0)))
101 #else // !XMDEBUG
102 #define XMASSERT(Expression) ((VOID)0)
103 #endif // !XMDEBUG
104 #endif // !XMASSERT
105
106 #if !defined(XM_NO_ALIGNMENT)
107 #define _DECLSPEC_ALIGN_16_   __declspec(align(16))
108 #else
109 #define _DECLSPEC_ALIGN_16_
110 #endif
111
112
113 #if defined(_MSC_VER) && (_MSC_VER<1500) && (_MSC_VER>=1400)
114 #define _XM_ISVS2005_
115 #endif
116
117 /****************************************************************************
118  *
119  * Constant definitions
120  *
121  ****************************************************************************/
122
123 #define XM_PI               3.141592654f
124 #define XM_2PI              6.283185307f
125 #define XM_1DIVPI           0.318309886f
126 #define XM_1DIV2PI          0.159154943f
127 #define XM_PIDIV2           1.570796327f
128 #define XM_PIDIV4           0.785398163f
129
130 #define XM_SELECT_0         0x00000000
131 #define XM_SELECT_1         0xFFFFFFFF
132
133 #define XM_PERMUTE_0X       0x00010203
134 #define XM_PERMUTE_0Y       0x04050607
135 #define XM_PERMUTE_0Z       0x08090A0B
136 #define XM_PERMUTE_0W       0x0C0D0E0F
137 #define XM_PERMUTE_1X       0x10111213
138 #define XM_PERMUTE_1Y       0x14151617
139 #define XM_PERMUTE_1Z       0x18191A1B
140 #define XM_PERMUTE_1W       0x1C1D1E1F
141
142 #define XM_CRMASK_CR6       0x000000F0
143 #define XM_CRMASK_CR6TRUE   0x00000080
144 #define XM_CRMASK_CR6FALSE  0x00000020
145 #define XM_CRMASK_CR6BOUNDS XM_CRMASK_CR6FALSE
146
147
148 #define XM_CACHE_LINE_SIZE  64
149
150 /****************************************************************************
151  *
152  * Macros
153  *
154  ****************************************************************************/
155
156 // Unit conversion
157
158 XMFINLINE FLOAT XMConvertToRadians(FLOAT fDegrees) { return fDegrees * (XM_PI / 180.0f); }
159 XMFINLINE FLOAT XMConvertToDegrees(FLOAT fRadians) { return fRadians * (180.0f / XM_PI); }
160
161 // Condition register evaluation proceeding a recording (Rc) comparison
162
163 #define XMComparisonAllTrue(CR)            (((CR) & XM_CRMASK_CR6TRUE) == XM_CRMASK_CR6TRUE)
164 #define XMComparisonAnyTrue(CR)            (((CR) & XM_CRMASK_CR6FALSE) != XM_CRMASK_CR6FALSE)
165 #define XMComparisonAllFalse(CR)           (((CR) & XM_CRMASK_CR6FALSE) == XM_CRMASK_CR6FALSE)
166 #define XMComparisonAnyFalse(CR)           (((CR) & XM_CRMASK_CR6TRUE) != XM_CRMASK_CR6TRUE)
167 #define XMComparisonMixed(CR)              (((CR) & XM_CRMASK_CR6) == 0)
168 #define XMComparisonAllInBounds(CR)        (((CR) & XM_CRMASK_CR6BOUNDS) == XM_CRMASK_CR6BOUNDS)
169 #define XMComparisonAnyOutOfBounds(CR)     (((CR) & XM_CRMASK_CR6BOUNDS) != XM_CRMASK_CR6BOUNDS)
170
171
172 #define XMMin(a, b) (((a) < (b)) ? (a) : (b))
173 #define XMMax(a, b) (((a) > (b)) ? (a) : (b))
174
175 /****************************************************************************
176  *
177  * Data types
178  *
179  ****************************************************************************/
180
181 #pragma warning(push)
182 #pragma warning(disable:4201 4365 4324)
183
184 #ifdef _XM_BIGENDIAN_
185 #pragma bitfield_order(push)
186 #pragma bitfield_order(lsb_to_msb)
187 #endif
188
189 //------------------------------------------------------------------------------
190 #if defined(_XM_NO_INTRINSICS_) && !defined(_XBOX_VER)
191 // The __vector4 structure is an intrinsic on Xbox but must be separately defined
192 // for x86/x64
193 typedef struct __vector4
194 {
195     union
196     {
197         float        vector4_f32[4];
198         unsigned int vector4_u32[4];
199 #ifndef XM_STRICT_VECTOR4
200         struct
201         {
202             FLOAT x;
203             FLOAT y;
204             FLOAT z;
205             FLOAT w;
206         };
207         FLOAT v[4];
208         UINT  u[4];
209 #endif // !XM_STRICT_VECTOR4
210     };
211 } __vector4;
212 #endif // _XM_NO_INTRINSICS_
213
214 //------------------------------------------------------------------------------
215 #if (defined (_XM_X86_) || defined(_XM_X64_)) && defined(_XM_NO_INTRINSICS_)
216 typedef UINT __vector4i[4];
217 #else
218 typedef __declspec(align(16)) UINT __vector4i[4];
219 #endif
220
221 //------------------------------------------------------------------------------
222 // Vector intrinsic: Four 32 bit floating point components aligned on a 16 byte 
223 // boundary and mapped to hardware vector registers
224 #if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
225 typedef __m128 XMVECTOR;
226 #else
227 typedef __vector4 XMVECTOR;
228 #endif
229
230 // Fix-up for (1st-3rd) XMVECTOR parameters that are pass-in-register for x86 and Xbox 360, but not for other targets
231 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
232 typedef const XMVECTOR FXMVECTOR;
233 #elif defined(_XM_X86_) && !defined(_XM_NO_INTRINSICS_)
234 typedef const XMVECTOR FXMVECTOR;
235 #elif defined(__cplusplus)
236 typedef const XMVECTOR& FXMVECTOR;
237 #else
238 typedef const XMVECTOR FXMVECTOR;
239 #endif
240
241 // Fix-up for (4th+) XMVECTOR parameters to pass in-register for Xbox 360 and by reference otherwise
242 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
243 typedef const XMVECTOR CXMVECTOR;
244 #elif defined(__cplusplus)
245 typedef const XMVECTOR& CXMVECTOR;
246 #else
247 typedef const XMVECTOR CXMVECTOR;
248 #endif
249
250 //------------------------------------------------------------------------------
251 // Conversion types for constants
252 typedef _DECLSPEC_ALIGN_16_ struct XMVECTORF32 {
253     union {
254         float f[4];
255         XMVECTOR v;
256     };
257
258 #if defined(__cplusplus)
259     inline operator XMVECTOR() const { return v; }
260     inline operator const float*() const { return f; }
261 #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
262     inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
263     inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
264 #endif
265 #endif // __cplusplus
266 } XMVECTORF32;
267
268 typedef _DECLSPEC_ALIGN_16_ struct XMVECTORI32 {
269     union {
270         INT i[4];
271         XMVECTOR v;
272     };
273 #if defined(__cplusplus)
274     inline operator XMVECTOR() const { return v; }
275 #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
276     inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
277     inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
278 #endif
279 #endif // __cplusplus
280 } XMVECTORI32;
281
282 typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU8 {
283     union {
284         BYTE u[16];
285         XMVECTOR v;
286     };
287 #if defined(__cplusplus)
288     inline operator XMVECTOR() const { return v; }
289 #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
290     inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
291     inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
292 #endif
293 #endif // __cplusplus
294 } XMVECTORU8;
295
296 typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU32 {
297     union {
298         UINT u[4];
299         XMVECTOR v;
300     };
301 #if defined(__cplusplus)
302     inline operator XMVECTOR() const { return v; }
303 #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
304     inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
305     inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
306 #endif
307 #endif // __cplusplus
308 } XMVECTORU32;
309
310 //------------------------------------------------------------------------------
311 // Vector operators
312 #if defined(__cplusplus) && !defined(XM_NO_OPERATOR_OVERLOADS)
313
314 XMVECTOR    operator+ (FXMVECTOR V);
315 XMVECTOR    operator- (FXMVECTOR V);
316
317 XMVECTOR&   operator+= (XMVECTOR& V1, FXMVECTOR V2);
318 XMVECTOR&   operator-= (XMVECTOR& V1, FXMVECTOR V2);
319 XMVECTOR&   operator*= (XMVECTOR& V1, FXMVECTOR V2);
320 XMVECTOR&   operator/= (XMVECTOR& V1, FXMVECTOR V2);
321 XMVECTOR&   operator*= (XMVECTOR& V, FLOAT S);
322 XMVECTOR&   operator/= (XMVECTOR& V, FLOAT S);
323
324 XMVECTOR    operator+ (FXMVECTOR V1, FXMVECTOR V2);
325 XMVECTOR    operator- (FXMVECTOR V1, FXMVECTOR V2);
326 XMVECTOR    operator* (FXMVECTOR V1, FXMVECTOR V2);
327 XMVECTOR    operator/ (FXMVECTOR V1, FXMVECTOR V2);
328 XMVECTOR    operator* (FXMVECTOR V, FLOAT S);
329 XMVECTOR    operator* (FLOAT S, FXMVECTOR V);
330 XMVECTOR    operator/ (FXMVECTOR V, FLOAT S);
331
332 #endif // __cplusplus && !XM_NO_OPERATOR_OVERLOADS
333
334 //------------------------------------------------------------------------------
335 // Matrix type: Sixteen 32 bit floating point components aligned on a
336 // 16 byte boundary and mapped to four hardware vector registers
337 #if (defined(_XM_X86_) || defined(_XM_X64_)) && defined(_XM_NO_INTRINSICS_)
338 typedef struct _XMMATRIX
339 #else
340 typedef _DECLSPEC_ALIGN_16_ struct _XMMATRIX
341 #endif
342 {
343 #if defined(_XM_NO_INTRINSICS_) || !defined(XM_STRICT_MATRIX)
344     union
345     {
346         XMVECTOR r[4];
347         struct
348         {
349             FLOAT _11, _12, _13, _14;
350             FLOAT _21, _22, _23, _24;
351             FLOAT _31, _32, _33, _34;
352             FLOAT _41, _42, _43, _44;
353         };
354         FLOAT m[4][4];
355     };
356 #else
357     XMVECTOR r[4];
358 #endif
359
360 #ifdef __cplusplus
361
362     _XMMATRIX() {};
363     _XMMATRIX(FXMVECTOR R0, FXMVECTOR R1, FXMVECTOR R2, CXMVECTOR R3);
364     _XMMATRIX(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
365               FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
366               FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
367               FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33);
368     explicit _XMMATRIX(_In_count_c_(16) CONST FLOAT *pArray);
369
370 #if defined(_XM_NO_INTRINSICS_) || !defined(XM_STRICT_MATRIX)
371     FLOAT       operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
372     FLOAT&      operator() (UINT Row, UINT Column) { return m[Row][Column]; }
373 #endif
374
375     _XMMATRIX&  operator= (CONST _XMMATRIX& M);
376
377 #ifndef XM_NO_OPERATOR_OVERLOADS
378     _XMMATRIX&  operator*= (CONST _XMMATRIX& M);
379     _XMMATRIX   operator* (CONST _XMMATRIX& M) CONST;
380 #endif // !XM_NO_OPERATOR_OVERLOADS
381
382 #endif // __cplusplus
383
384 } XMMATRIX;
385
386 // Fix-up for XMMATRIX parameters to pass in-register on Xbox 360, by reference otherwise
387 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
388 typedef const XMMATRIX CXMMATRIX;
389 #elif defined(__cplusplus)
390 typedef const XMMATRIX& CXMMATRIX;
391 #else
392 typedef const XMMATRIX CXMMATRIX;
393 #endif
394
395 //------------------------------------------------------------------------------
396 // 16 bit floating point number consisting of a sign bit, a 5 bit biased 
397 // exponent, and a 10 bit mantissa
398 typedef USHORT HALF;
399
400 //------------------------------------------------------------------------------
401 // 2D Vector; 32 bit floating point components
402 typedef struct _XMFLOAT2
403 {
404     FLOAT x;
405     FLOAT y;
406
407 #ifdef __cplusplus
408
409     _XMFLOAT2() {};
410     _XMFLOAT2(FLOAT _x, FLOAT _y) : x(_x), y(_y) {};
411     _XMFLOAT2(_In_count_c_(2) CONST FLOAT *pArray);
412
413     _XMFLOAT2& operator= (CONST _XMFLOAT2& Float2);
414
415 #endif // __cplusplus
416
417 } XMFLOAT2;
418
419 // 2D Vector; 32 bit floating point components aligned on a 16 byte boundary
420 #ifdef __cplusplus
421 __declspec(align(16)) struct XMFLOAT2A : public XMFLOAT2
422 {
423     XMFLOAT2A() : XMFLOAT2() {};
424     XMFLOAT2A(FLOAT _x, FLOAT _y) : XMFLOAT2(_x, _y) {};
425     XMFLOAT2A(_In_count_c_(2) CONST FLOAT *pArray) : XMFLOAT2(pArray) {};
426
427     XMFLOAT2A& operator= (CONST XMFLOAT2A& Float2);
428 };
429 #else
430 typedef __declspec(align(16)) XMFLOAT2 XMFLOAT2A;
431 #endif // __cplusplus
432
433 //------------------------------------------------------------------------------
434 // 2D Vector; 32 bit signed integer components
435 typedef struct _XMINT2
436 {
437     INT x;
438     INT y;
439
440 #ifdef __cplusplus
441
442     _XMINT2() {};
443     _XMINT2(INT _x, INT _y) : x(_x), y(_y) {};
444     explicit _XMINT2(_In_count_c_(2) CONST INT *pArray);
445
446     _XMINT2& operator= (CONST _XMINT2& Int2);
447
448 #endif // __cplusplus
449
450 } XMINT2;
451
452 // 2D Vector; 32 bit unsigned integer components
453 typedef struct _XMUINT2
454 {
455     UINT x;
456     UINT y;
457
458 #ifdef __cplusplus
459
460     _XMUINT2() {};
461     _XMUINT2(UINT _x, UINT _y) : x(_x), y(_y) {};
462     explicit _XMUINT2(_In_count_c_(2) CONST UINT *pArray);
463
464     _XMUINT2& operator= (CONST _XMUINT2& UInt2);
465
466 #endif // __cplusplus
467
468 } XMUINT2;
469
470 //------------------------------------------------------------------------------
471 // 2D Vector; 16 bit floating point components
472 typedef struct _XMHALF2
473 {
474     HALF x;
475     HALF y;
476
477 #ifdef __cplusplus
478
479     _XMHALF2() {};
480     _XMHALF2(HALF _x, HALF _y) : x(_x), y(_y) {};
481     explicit _XMHALF2(_In_count_c_(2) CONST HALF *pArray);
482     _XMHALF2(FLOAT _x, FLOAT _y);
483     explicit _XMHALF2(_In_count_c_(2) CONST FLOAT *pArray);
484
485     _XMHALF2& operator= (CONST _XMHALF2& Half2);
486
487 #endif // __cplusplus
488
489 } XMHALF2;
490
491 //------------------------------------------------------------------------------
492 // 2D Vector; 16 bit signed normalized integer components
493 typedef struct _XMSHORTN2
494 {
495     SHORT x;
496     SHORT y;
497
498 #ifdef __cplusplus
499
500     _XMSHORTN2() {};
501     _XMSHORTN2(SHORT _x, SHORT _y) : x(_x), y(_y) {};
502     explicit _XMSHORTN2(_In_count_c_(2) CONST SHORT *pArray);
503     _XMSHORTN2(FLOAT _x, FLOAT _y);
504     explicit _XMSHORTN2(_In_count_c_(2) CONST FLOAT *pArray);
505
506     _XMSHORTN2& operator= (CONST _XMSHORTN2& ShortN2);
507
508 #endif // __cplusplus
509
510 } XMSHORTN2;
511
512 // 2D Vector; 16 bit signed integer components
513 typedef struct _XMSHORT2
514 {
515     SHORT x;
516     SHORT y;
517
518 #ifdef __cplusplus
519
520     _XMSHORT2() {};
521     _XMSHORT2(SHORT _x, SHORT _y) : x(_x), y(_y) {};
522     explicit _XMSHORT2(_In_count_c_(2) CONST SHORT *pArray);
523     _XMSHORT2(FLOAT _x, FLOAT _y);
524     explicit _XMSHORT2(_In_count_c_(2) CONST FLOAT *pArray);
525
526     _XMSHORT2& operator= (CONST _XMSHORT2& Short2);
527
528 #endif // __cplusplus
529
530 } XMSHORT2;
531
532 // 2D Vector; 16 bit unsigned normalized integer components
533 typedef struct _XMUSHORTN2
534 {
535     USHORT x;
536     USHORT y;
537
538 #ifdef __cplusplus
539
540     _XMUSHORTN2() {};
541     _XMUSHORTN2(USHORT _x, USHORT _y) : x(_x), y(_y) {};
542     explicit _XMUSHORTN2(_In_count_c_(2) CONST USHORT *pArray);
543     _XMUSHORTN2(FLOAT _x, FLOAT _y);
544     explicit _XMUSHORTN2(_In_count_c_(2) CONST FLOAT *pArray);
545
546     _XMUSHORTN2& operator= (CONST _XMUSHORTN2& UShortN2);
547
548 #endif // __cplusplus
549
550 } XMUSHORTN2;
551
552 // 2D Vector; 16 bit unsigned integer components
553 typedef struct _XMUSHORT2
554 {
555     USHORT x;
556     USHORT y;
557
558 #ifdef __cplusplus
559
560     _XMUSHORT2() {};
561     _XMUSHORT2(USHORT _x, USHORT _y) : x(_x), y(_y) {};
562     explicit _XMUSHORT2(_In_count_c_(2) CONST USHORT *pArray);
563     _XMUSHORT2(FLOAT _x, FLOAT _y);
564     explicit _XMUSHORT2(_In_count_c_(2) CONST FLOAT *pArray);
565
566     _XMUSHORT2& operator= (CONST _XMUSHORT2& UShort2);
567
568 #endif // __cplusplus
569
570 } XMUSHORT2;
571
572 //------------------------------------------------------------------------------
573 // 2D Vector; 8 bit signed normalized integer components
574 typedef struct _XMBYTEN2
575 {
576     CHAR x;
577     CHAR y;
578
579 #ifdef __cplusplus
580
581     _XMBYTEN2() {};
582     _XMBYTEN2(CHAR _x, CHAR _y) : x(_x), y(_y) {};
583     explicit _XMBYTEN2(_In_count_c_(2) CONST CHAR *pArray);
584     _XMBYTEN2(FLOAT _x, FLOAT _y);
585     explicit _XMBYTEN2(_In_count_c_(2) CONST FLOAT *pArray);
586
587     _XMBYTEN2& operator= (CONST _XMBYTEN2& ByteN2);
588
589 #endif // __cplusplus
590
591 } XMBYTEN2;
592
593 // 2D Vector; 8 bit signed integer components
594 typedef struct _XMBYTE2
595 {
596     CHAR x;
597     CHAR y;
598
599 #ifdef __cplusplus
600
601     _XMBYTE2() {};
602     _XMBYTE2(CHAR _x, CHAR _y) : x(_x), y(_y) {};
603     explicit _XMBYTE2(_In_count_c_(2) CONST CHAR *pArray);
604     _XMBYTE2(FLOAT _x, FLOAT _y);
605     explicit _XMBYTE2(_In_count_c_(2) CONST FLOAT *pArray);
606
607     _XMBYTE2& operator= (CONST _XMBYTE2& Byte2);
608
609 #endif // __cplusplus
610
611 } XMBYTE2;
612
613 // 2D Vector; 8 bit unsigned normalized integer components
614 typedef struct _XMUBYTEN2
615 {
616     BYTE x;
617     BYTE y;
618
619 #ifdef __cplusplus
620
621     _XMUBYTEN2() {};
622     _XMUBYTEN2(BYTE _x, BYTE _y) : x(_x), y(_y) {};
623     explicit _XMUBYTEN2(_In_count_c_(2) CONST BYTE *pArray);
624     _XMUBYTEN2(FLOAT _x, FLOAT _y);
625     explicit _XMUBYTEN2(_In_count_c_(2) CONST FLOAT *pArray);
626
627     _XMUBYTEN2& operator= (CONST _XMUBYTEN2& UByteN2);
628
629 #endif // __cplusplus
630
631 } XMUBYTEN2;
632
633
634 // 2D Vector; 8 bit unsigned integer components
635 typedef struct _XMUBYTE2
636 {
637     BYTE x;
638     BYTE y;
639
640 #ifdef __cplusplus
641
642     _XMUBYTE2() {};
643     _XMUBYTE2(BYTE _x, BYTE _y) : x(_x), y(_y) {};
644     explicit _XMUBYTE2(_In_count_c_(2) CONST BYTE *pArray);
645     _XMUBYTE2(FLOAT _x, FLOAT _y);
646     explicit _XMUBYTE2(_In_count_c_(2) CONST FLOAT *pArray);
647
648     _XMUBYTE2& operator= (CONST _XMUBYTE2& UByte2);
649
650 #endif // __cplusplus
651
652 } XMUBYTE2;
653
654 //------------------------------------------------------------------------------
655 // 3D Vector; 32 bit floating point components
656 typedef struct _XMFLOAT3
657 {
658     FLOAT x;
659     FLOAT y;
660     FLOAT z;
661
662 #ifdef __cplusplus
663
664     _XMFLOAT3() {};
665     _XMFLOAT3(FLOAT _x, FLOAT _y, FLOAT _z) : x(_x), y(_y), z(_z) {};
666     _XMFLOAT3(_In_count_c_(3) CONST FLOAT *pArray);
667
668     _XMFLOAT3& operator= (CONST _XMFLOAT3& Float3);
669
670 #endif // __cplusplus
671
672 } XMFLOAT3;
673
674 // 3D Vector; 32 bit floating point components aligned on a 16 byte boundary
675 #ifdef __cplusplus
676 __declspec(align(16)) struct XMFLOAT3A : public XMFLOAT3
677 {
678     XMFLOAT3A() : XMFLOAT3() {};
679     XMFLOAT3A(FLOAT _x, FLOAT _y, FLOAT _z) : XMFLOAT3(_x, _y, _z) {};
680     XMFLOAT3A(_In_count_c_(3) CONST FLOAT *pArray) : XMFLOAT3(pArray) {};
681
682     XMFLOAT3A& operator= (CONST XMFLOAT3A& Float3);
683 };
684 #else
685 typedef __declspec(align(16)) XMFLOAT3 XMFLOAT3A; 
686 #endif // __cplusplus
687
688 //------------------------------------------------------------------------------
689 // 3D Vector; 32 bit signed integer components
690 typedef struct _XMINT3
691 {
692     INT x;
693     INT y;
694     INT z;
695
696 #ifdef __cplusplus
697
698     _XMINT3() {};
699     _XMINT3(INT _x, INT _y, INT _z) : x(_x), y(_y), z(_z) {};
700     explicit _XMINT3(_In_count_c_(3) CONST INT *pArray);
701
702     _XMINT3& operator= (CONST _XMINT3& Int3);
703
704 #endif // __cplusplus
705
706 } XMINT3;
707
708 // 3D Vector; 32 bit unsigned integer components
709 typedef struct _XMUINT3
710 {
711     UINT x;
712     UINT y;
713     UINT z;
714
715 #ifdef __cplusplus
716
717     _XMUINT3() {};
718     _XMUINT3(UINT _x, UINT _y, UINT _z) : x(_x), y(_y), z(_z) {};
719     explicit _XMUINT3(_In_count_c_(3) CONST UINT *pArray);
720
721     _XMUINT3& operator= (CONST _XMUINT3& UInt3);
722
723 #endif // __cplusplus
724
725 } XMUINT3;
726
727 //------------------------------------------------------------------------------
728 // 3D Vector; 11-11-10 bit normalized components packed into a 32 bit integer
729 // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit signed, 
730 // normalized integer for the z component and 11 bit signed, normalized 
731 // integers for the x and y components.  The z component is stored in the 
732 // most significant bits and the x component in the least significant bits
733 // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
734 typedef struct _XMHENDN3
735 {
736     union
737     {
738         struct
739         {
740             INT  x   : 11;    // -1023/1023 to 1023/1023
741             INT  y   : 11;    // -1023/1023 to 1023/1023
742             INT  z   : 10;    // -511/511 to 511/511
743         };
744         UINT v;
745     };
746
747 #ifdef __cplusplus
748
749     _XMHENDN3() {};
750     explicit _XMHENDN3(UINT Packed) : v(Packed) {};
751     _XMHENDN3(FLOAT _x, FLOAT _y, FLOAT _z);
752     explicit _XMHENDN3(_In_count_c_(3) CONST FLOAT *pArray);
753
754     operator UINT () const { return v; }
755
756     _XMHENDN3& operator= (CONST _XMHENDN3& HenDN3);
757     _XMHENDN3& operator= (CONST UINT Packed);
758
759 #endif // __cplusplus
760
761 } XMHENDN3;
762
763 // 3D Vector; 11-11-10 bit components packed into a 32 bit integer
764 // The 3D Vector is packed into 32 bits as follows: a 10 bit signed, 
765 // integer for the z component and 11 bit signed integers for the 
766 // x and y components.  The z component is stored in the 
767 // most significant bits and the x component in the least significant bits
768 // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
769 typedef struct _XMHEND3
770 {
771     union
772     {
773         struct
774         {
775             INT  x   : 11;    // -1023 to 1023
776             INT  y   : 11;    // -1023 to 1023
777             INT  z   : 10;    // -511 to 511
778         };
779         UINT v;
780     };
781
782 #ifdef __cplusplus
783
784     _XMHEND3() {};
785     explicit _XMHEND3(UINT Packed) : v(Packed) {};
786     _XMHEND3(FLOAT _x, FLOAT _y, FLOAT _z);
787     explicit _XMHEND3(_In_count_c_(3) CONST FLOAT *pArray);
788
789     operator UINT () const { return v; }
790
791     _XMHEND3& operator= (CONST _XMHEND3& HenD3);
792     _XMHEND3& operator= (CONST UINT Packed);
793
794 #endif // __cplusplus
795
796 } XMHEND3;
797
798 // 3D Vector; 11-11-10 bit normalized components packed into a 32 bit integer
799 // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit unsigned, 
800 // normalized integer for the z component and 11 bit unsigned, normalized 
801 // integers for the x and y components.  The z component is stored in the 
802 // most significant bits and the x component in the least significant bits
803 // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
804 typedef struct _XMUHENDN3
805 {
806     union
807     {
808         struct
809         {
810             UINT  x  : 11;    // 0/2047 to 2047/2047
811             UINT  y  : 11;    // 0/2047 to 2047/2047
812             UINT  z  : 10;    // 0/1023 to 1023/1023
813         };
814         UINT v;
815     };
816
817 #ifdef __cplusplus
818
819     _XMUHENDN3() {};
820     explicit _XMUHENDN3(UINT Packed) : v(Packed) {};
821     _XMUHENDN3(FLOAT _x, FLOAT _y, FLOAT _z);
822     explicit _XMUHENDN3(_In_count_c_(3) CONST FLOAT *pArray);
823
824     operator UINT () const { return v; }
825
826     _XMUHENDN3& operator= (CONST _XMUHENDN3& UHenDN3);
827     _XMUHENDN3& operator= (CONST UINT Packed);
828
829 #endif // __cplusplus
830
831 } XMUHENDN3;
832
833 // 3D Vector; 11-11-10 bit components packed into a 32 bit integer
834 // The 3D Vector is packed into 32 bits as follows: a 10 bit unsigned
835 // integer for the z component and 11 bit unsigned integers 
836 // for the x and y components.  The z component is stored in the 
837 // most significant bits and the x component in the least significant bits
838 // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
839 typedef struct _XMUHEND3
840 {
841     union
842     {
843         struct
844         {
845             UINT  x  : 11;    // 0 to 2047
846             UINT  y  : 11;    // 0 to 2047
847             UINT  z  : 10;    // 0 to 1023
848         };
849         UINT v;
850     };
851
852 #ifdef __cplusplus
853
854     _XMUHEND3() {};
855     explicit _XMUHEND3(UINT Packed) : v(Packed) {};
856     _XMUHEND3(FLOAT _x, FLOAT _y, FLOAT _z);
857     explicit _XMUHEND3(_In_count_c_(3) CONST FLOAT *pArray);
858
859     operator UINT () const { return v; }
860
861     _XMUHEND3& operator= (CONST _XMUHEND3& UHenD3);
862     _XMUHEND3& operator= (CONST UINT Packed);
863
864 #endif // __cplusplus
865
866 } XMUHEND3;
867
868 // 3D Vector; 10-11-11 bit normalized components packed into a 32 bit integer
869 // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit signed, 
870 // normalized integer for the x component and 11 bit signed, normalized 
871 // integers for the y and z components.  The z component is stored in the 
872 // most significant bits and the x component in the least significant bits
873 // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
874 typedef struct _XMDHENN3
875 {
876     union
877     {
878         struct
879         {
880             INT  x   : 10;    // -511/511 to 511/511
881             INT  y   : 11;    // -1023/1023 to 1023/1023
882             INT  z   : 11;    // -1023/1023 to 1023/1023
883         };
884         UINT v;
885     };
886
887 #ifdef __cplusplus
888
889     _XMDHENN3() {};
890     explicit _XMDHENN3(UINT Packed) : v(Packed) {};
891     _XMDHENN3(FLOAT _x, FLOAT _y, FLOAT _z);
892     explicit _XMDHENN3(_In_count_c_(3) CONST FLOAT *pArray);
893
894     operator UINT () const { return v; }
895
896     _XMDHENN3& operator= (CONST _XMDHENN3& DHenN3);
897     _XMDHENN3& operator= (CONST UINT Packed);
898
899 #endif // __cplusplus
900
901 } XMDHENN3;
902
903 // 3D Vector; 10-11-11 bit components packed into a 32 bit integer
904 // The 3D Vector is packed into 32 bits as follows: a 10 bit signed, 
905 // integer for the x component and 11 bit signed integers for the 
906 // y and z components.  The w component is stored in the 
907 // most significant bits and the x component in the least significant bits
908 // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
909 typedef struct _XMDHEN3
910 {
911     union
912     {
913         struct
914         {
915             INT  x   : 10;    // -511 to 511
916             INT  y   : 11;    // -1023 to 1023
917             INT  z   : 11;    // -1023 to 1023
918         };
919         UINT v;
920     };
921
922 #ifdef __cplusplus
923
924     _XMDHEN3() {};
925     explicit _XMDHEN3(UINT Packed) : v(Packed) {};
926     _XMDHEN3(FLOAT _x, FLOAT _y, FLOAT _z);
927     explicit _XMDHEN3(_In_count_c_(3) CONST FLOAT *pArray);
928
929     operator UINT () const { return v; }
930
931     _XMDHEN3& operator= (CONST _XMDHEN3& DHen3);
932     _XMDHEN3& operator= (CONST UINT Packed);
933
934 #endif // __cplusplus
935
936 } XMDHEN3;
937
938 // 3D Vector; 10-11-11 bit normalized components packed into a 32 bit integer
939 // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit unsigned, 
940 // normalized integer for the x component and 11 bit unsigned, normalized 
941 // integers for the y and z components.  The w component is stored in the 
942 // most significant bits and the x component in the least significant bits
943 // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
944 typedef struct _XMUDHENN3
945 {
946     union
947     {
948         struct
949         {
950             UINT  x  : 10;    // 0/1023 to 1023/1023
951             UINT  y  : 11;    // 0/2047 to 2047/2047
952             UINT  z  : 11;    // 0/2047 to 2047/2047
953         };
954         UINT v;
955     };
956
957 #ifdef __cplusplus
958
959     _XMUDHENN3() {};
960     explicit _XMUDHENN3(UINT Packed) : v(Packed) {};
961     _XMUDHENN3(FLOAT _x, FLOAT _y, FLOAT _z);
962     explicit _XMUDHENN3(_In_count_c_(3) CONST FLOAT *pArray);
963
964     operator UINT () const { return v; }
965
966     _XMUDHENN3& operator= (CONST _XMUDHENN3& UDHenN3);
967     _XMUDHENN3& operator= (CONST UINT Packed);
968
969 #endif // __cplusplus
970
971 } XMUDHENN3;
972
973 // 3D Vector; 10-11-11 bit components packed into a 32 bit integer
974 // The 3D Vector is packed into 32 bits as follows: a 10 bit unsigned, 
975 // integer for the x component and 11 bit unsigned integers 
976 // for the y and z components.  The w component is stored in the 
977 // most significant bits and the x component in the least significant bits
978 // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
979 typedef struct _XMUDHEN3
980 {
981     union
982     {
983         struct
984         {
985             UINT  x  : 10;    // 0 to 1023
986             UINT  y  : 11;    // 0 to 2047
987             UINT  z  : 11;    // 0 to 2047
988         };
989         UINT v;
990     };
991
992 #ifdef __cplusplus
993
994     _XMUDHEN3() {};
995     explicit _XMUDHEN3(UINT Packed) : v(Packed) {};
996     _XMUDHEN3(FLOAT _x, FLOAT _y, FLOAT _z);
997     explicit _XMUDHEN3(_In_count_c_(3) CONST FLOAT *pArray);
998
999     operator UINT () const { return v; }
1000
1001     _XMUDHEN3& operator= (CONST _XMUDHEN3& UDHen3);
1002     _XMUDHEN3& operator= (CONST UINT Packed);
1003
1004 #endif // __cplusplus
1005
1006 } XMUDHEN3;
1007
1008 //------------------------------------------------------------------------------
1009 // 3D vector: 5/6/5 unsigned integer components
1010 typedef struct _XMU565
1011 {
1012     union
1013     {
1014         struct
1015         {
1016             USHORT x  : 5;
1017             USHORT y  : 6;
1018             USHORT z  : 5;
1019         };
1020         USHORT v;
1021     };
1022
1023 #ifdef __cplusplus
1024
1025     _XMU565() {};
1026     explicit _XMU565(USHORT Packed) : v(Packed) {};
1027     _XMU565(CHAR _x, CHAR _y, CHAR _z) : x(_x), y(_y), z(_z) {};
1028     explicit _XMU565(_In_count_c_(3) CONST CHAR *pArray);
1029     _XMU565(FLOAT _x, FLOAT _y, FLOAT _z);
1030     explicit _XMU565(_In_count_c_(3) CONST FLOAT *pArray);
1031
1032     operator USHORT () const { return v; }
1033
1034     _XMU565& operator= (CONST _XMU565& U565);
1035     _XMU565& operator= (CONST USHORT Packed);
1036
1037 #endif // __cplusplus
1038
1039 } XMU565;
1040
1041 //------------------------------------------------------------------------------
1042 // 3D vector: 11/11/10 floating-point components
1043 // The 3D vector is packed into 32 bits as follows: a 5-bit biased exponent
1044 // and 6-bit mantissa for x component, a 5-bit biased exponent and
1045 // 6-bit mantissa for y component, a 5-bit biased exponent and a 5-bit
1046 // mantissa for z. The z component is stored in the most significant bits
1047 // and the x component in the least significant bits. No sign bits so
1048 // all partial-precision numbers are positive.
1049 // (Z10Y11X11): [32] ZZZZZzzz zzzYYYYY yyyyyyXX XXXxxxxx [0]
1050 typedef struct _XMFLOAT3PK
1051 {
1052     union
1053     {
1054         struct
1055         {
1056             UINT xm : 6;
1057             UINT xe : 5;
1058             UINT ym : 6;
1059             UINT ye : 5;
1060             UINT zm : 5;
1061             UINT ze : 5;
1062         };
1063         UINT v;
1064     };
1065
1066 #ifdef __cplusplus
1067
1068     _XMFLOAT3PK() {};
1069     explicit _XMFLOAT3PK(UINT Packed) : v(Packed) {};
1070     _XMFLOAT3PK(FLOAT _x, FLOAT _y, FLOAT _z);
1071     explicit _XMFLOAT3PK(_In_count_c_(3) CONST FLOAT *pArray);
1072
1073     operator UINT () const { return v; }
1074
1075     _XMFLOAT3PK& operator= (CONST _XMFLOAT3PK& float3pk);
1076     _XMFLOAT3PK& operator= (CONST UINT Packed);
1077
1078 #endif // __cplusplus
1079
1080 } XMFLOAT3PK;
1081
1082 //------------------------------------------------------------------------------
1083 // 3D vector: 9/9/9 floating-point components with shared 5-bit exponent
1084 // The 3D vector is packed into 32 bits as follows: a 5-bit biased exponent
1085 // with 9-bit mantissa for the x, y, and z component. The shared exponent
1086 // is stored in the most significant bits and the x component mantissa is in
1087 // the least significant bits. No sign bits so all partial-precision numbers
1088 // are positive.
1089 // (E5Z9Y9X9): [32] EEEEEzzz zzzzzzyy yyyyyyyx xxxxxxxx [0]
1090 typedef struct _XMFLOAT3SE
1091 {
1092     union
1093     {
1094         struct
1095         {
1096             UINT xm : 9;
1097             UINT ym : 9;
1098             UINT zm : 9;
1099             UINT e  : 5;
1100         };
1101         UINT v;
1102     };
1103
1104 #ifdef __cplusplus
1105
1106     _XMFLOAT3SE() {};
1107     explicit _XMFLOAT3SE(UINT Packed) : v(Packed) {};
1108     _XMFLOAT3SE(FLOAT _x, FLOAT _y, FLOAT _z);
1109     explicit _XMFLOAT3SE(_In_count_c_(3) CONST FLOAT *pArray);
1110
1111     operator UINT () const { return v; }
1112
1113     _XMFLOAT3SE& operator= (CONST _XMFLOAT3SE& float3se);
1114     _XMFLOAT3SE& operator= (CONST UINT Packed);
1115
1116 #endif // __cplusplus
1117
1118 } XMFLOAT3SE;
1119
1120 //------------------------------------------------------------------------------
1121 // 4D Vector; 32 bit floating point components
1122 typedef struct _XMFLOAT4
1123 {
1124     FLOAT x;
1125     FLOAT y;
1126     FLOAT z;
1127     FLOAT w;
1128
1129 #ifdef __cplusplus
1130
1131     _XMFLOAT4() {};
1132     _XMFLOAT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w) : x(_x), y(_y), z(_z), w(_w) {};
1133     _XMFLOAT4(_In_count_c_(4) CONST FLOAT *pArray);
1134
1135     _XMFLOAT4& operator= (CONST _XMFLOAT4& Float4);
1136
1137 #endif // __cplusplus
1138
1139 } XMFLOAT4;
1140
1141 // 4D Vector; 32 bit floating point components aligned on a 16 byte boundary
1142 #ifdef __cplusplus
1143 __declspec(align(16)) struct XMFLOAT4A : public XMFLOAT4
1144 {
1145     XMFLOAT4A() : XMFLOAT4() {};
1146     XMFLOAT4A(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w) : XMFLOAT4(_x, _y, _z, _w) {};
1147     XMFLOAT4A(_In_count_c_(4) CONST FLOAT *pArray) : XMFLOAT4(pArray) {};
1148
1149     XMFLOAT4A& operator= (CONST XMFLOAT4A& Float4);   
1150 };
1151 #else
1152 typedef __declspec(align(16)) XMFLOAT4 XMFLOAT4A;
1153 #endif // __cplusplus
1154
1155 //------------------------------------------------------------------------------
1156 // 4D Vector; 32 bit signed integer components
1157 typedef struct _XMINT4
1158 {
1159     INT x;
1160     INT y;
1161     INT z;
1162     INT w;
1163
1164 #ifdef __cplusplus
1165
1166     _XMINT4() {};
1167     _XMINT4(INT _x, INT _y, INT _z, INT _w) : x(_x), y(_y), z(_z), w(_w) {};
1168     explicit _XMINT4(_In_count_c_(4) CONST INT *pArray);
1169
1170     _XMINT4& operator= (CONST _XMINT4& Int4);
1171
1172 #endif // __cplusplus
1173
1174 } XMINT4;
1175
1176 // 4D Vector; 32 bit unsigned integer components
1177 typedef struct _XMUINT4
1178 {
1179     UINT x;
1180     UINT y;
1181     UINT z;
1182     UINT w;
1183
1184 #ifdef __cplusplus
1185
1186     _XMUINT4() {};
1187     _XMUINT4(UINT _x, UINT _y, UINT _z, UINT _w) : x(_x), y(_y), z(_z), w(_w) {};
1188     explicit _XMUINT4(_In_count_c_(4) CONST UINT *pArray);
1189
1190     _XMUINT4& operator= (CONST _XMUINT4& UInt4);
1191
1192 #endif // __cplusplus
1193
1194 } XMUINT4;
1195
1196 //------------------------------------------------------------------------------
1197 // 4D Vector; 16 bit floating point components
1198 typedef struct _XMHALF4
1199 {
1200     HALF x;
1201     HALF y;
1202     HALF z;
1203     HALF w;
1204
1205 #ifdef __cplusplus
1206
1207     _XMHALF4() {};
1208     _XMHALF4(HALF _x, HALF _y, HALF _z, HALF _w) : x(_x), y(_y), z(_z), w(_w) {};
1209     explicit _XMHALF4(_In_count_c_(4) CONST HALF *pArray);
1210     _XMHALF4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1211     explicit _XMHALF4(_In_count_c_(4) CONST FLOAT *pArray);
1212
1213     _XMHALF4& operator= (CONST _XMHALF4& Half4);
1214
1215 #endif // __cplusplus
1216
1217 } XMHALF4;
1218
1219 //------------------------------------------------------------------------------
1220 // 4D Vector; 16 bit signed normalized integer components
1221 typedef struct _XMSHORTN4
1222 {
1223     SHORT x;
1224     SHORT y;
1225     SHORT z;
1226     SHORT w;
1227
1228 #ifdef __cplusplus
1229
1230     _XMSHORTN4() {};
1231     _XMSHORTN4(SHORT _x, SHORT _y, SHORT _z, SHORT _w) : x(_x), y(_y), z(_z), w(_w) {};
1232     explicit _XMSHORTN4(_In_count_c_(4) CONST SHORT *pArray);
1233     _XMSHORTN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1234     explicit _XMSHORTN4(_In_count_c_(4) CONST FLOAT *pArray);
1235
1236     _XMSHORTN4& operator= (CONST _XMSHORTN4& ShortN4);
1237
1238 #endif // __cplusplus
1239
1240 } XMSHORTN4;
1241
1242 // 4D Vector; 16 bit signed integer components
1243 typedef struct _XMSHORT4
1244 {
1245     SHORT x;
1246     SHORT y;
1247     SHORT z;
1248     SHORT w;
1249
1250 #ifdef __cplusplus
1251
1252     _XMSHORT4() {};
1253     _XMSHORT4(SHORT _x, SHORT _y, SHORT _z, SHORT _w) : x(_x), y(_y), z(_z), w(_w) {};
1254     explicit _XMSHORT4(_In_count_c_(4) CONST SHORT *pArray);
1255     _XMSHORT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1256     explicit _XMSHORT4(_In_count_c_(4) CONST FLOAT *pArray);
1257
1258     _XMSHORT4& operator= (CONST _XMSHORT4& Short4);
1259
1260 #endif // __cplusplus
1261
1262 } XMSHORT4;
1263
1264 // 4D Vector; 16 bit unsigned normalized integer components
1265 typedef struct _XMUSHORTN4
1266 {
1267     USHORT x;
1268     USHORT y;
1269     USHORT z;
1270     USHORT w;
1271
1272 #ifdef __cplusplus
1273
1274     _XMUSHORTN4() {};
1275     _XMUSHORTN4(USHORT _x, USHORT _y, USHORT _z, USHORT _w) : x(_x), y(_y), z(_z), w(_w) {};
1276     explicit _XMUSHORTN4(_In_count_c_(4) CONST USHORT *pArray);
1277     _XMUSHORTN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1278     explicit _XMUSHORTN4(_In_count_c_(4) CONST FLOAT *pArray);
1279
1280     _XMUSHORTN4& operator= (CONST _XMUSHORTN4& UShortN4);
1281
1282 #endif // __cplusplus
1283
1284 } XMUSHORTN4;
1285
1286 // 4D Vector; 16 bit unsigned integer components
1287 typedef struct _XMUSHORT4
1288 {
1289     USHORT x;
1290     USHORT y;
1291     USHORT z;
1292     USHORT w;
1293
1294 #ifdef __cplusplus
1295
1296     _XMUSHORT4() {};
1297     _XMUSHORT4(USHORT _x, USHORT _y, USHORT _z, USHORT _w) : x(_x), y(_y), z(_z), w(_w) {};
1298     explicit _XMUSHORT4(_In_count_c_(4) CONST USHORT *pArray);
1299     _XMUSHORT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1300     explicit _XMUSHORT4(_In_count_c_(4) CONST FLOAT *pArray);
1301
1302     _XMUSHORT4& operator= (CONST _XMUSHORT4& UShort4);
1303
1304 #endif // __cplusplus
1305
1306 } XMUSHORT4;
1307
1308 //------------------------------------------------------------------------------
1309 // 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer
1310 // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned, 
1311 // normalized integer for the w component and 10 bit signed, normalized 
1312 // integers for the z, y, and x components.  The w component is stored in the 
1313 // most significant bits and the x component in the least significant bits
1314 // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
1315 typedef struct _XMXDECN4
1316 {
1317     union
1318     {
1319         struct
1320         {
1321             INT  x   : 10;    // -511/511 to 511/511
1322             INT  y   : 10;    // -511/511 to 511/511
1323             INT  z   : 10;    // -511/511 to 511/511
1324             UINT w   : 2;     //      0/3 to     3/3
1325         };
1326         UINT v;
1327     };
1328
1329 #ifdef __cplusplus
1330
1331     _XMXDECN4() {};
1332     explicit _XMXDECN4(UINT Packed) : v(Packed) {};
1333     _XMXDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1334     explicit _XMXDECN4(_In_count_c_(4) CONST FLOAT *pArray);
1335
1336     operator UINT () const { return v; }
1337
1338     _XMXDECN4& operator= (CONST _XMXDECN4& XDecN4);
1339     _XMXDECN4& operator= (CONST UINT Packed);
1340
1341 #endif // __cplusplus
1342
1343 } XMXDECN4;
1344
1345 // 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer
1346 // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned
1347 // integer for the w component and 10 bit signed integers for the 
1348 // z, y, and x components.  The w component is stored in the 
1349 // most significant bits and the x component in the least significant bits
1350 // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
1351 typedef struct _XMXDEC4
1352 {
1353     union
1354     {
1355         struct
1356         {
1357             INT  x   : 10;    // -511 to 511
1358             INT  y   : 10;    // -511 to 511
1359             INT  z   : 10;    // -511 to 511
1360             UINT w   : 2;     //    0 to   3
1361         };
1362         UINT v;
1363     };
1364
1365 #ifdef __cplusplus
1366
1367     _XMXDEC4() {};
1368     explicit _XMXDEC4(UINT Packed) : v(Packed) {};
1369     _XMXDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1370     explicit _XMXDEC4(_In_count_c_(4) CONST FLOAT *pArray);
1371
1372     operator UINT () const { return v; }
1373
1374     _XMXDEC4& operator= (CONST _XMXDEC4& XDec4);
1375     _XMXDEC4& operator= (CONST UINT Packed);
1376
1377 #endif // __cplusplus
1378
1379 } XMXDEC4;
1380
1381 // 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer
1382 // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit signed, 
1383 // normalized integer for the w component and 10 bit signed, normalized 
1384 // integers for the z, y, and x components.  The w component is stored in the 
1385 // most significant bits and the x component in the least significant bits
1386 // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
1387 typedef struct _XMDECN4
1388 {
1389     union
1390     {
1391         struct
1392         {
1393             INT  x   : 10;    // -511/511 to 511/511
1394             INT  y   : 10;    // -511/511 to 511/511
1395             INT  z   : 10;    // -511/511 to 511/511
1396             INT  w   : 2;     //     -1/1 to     1/1
1397         };
1398         UINT v;
1399     };
1400
1401 #ifdef __cplusplus
1402
1403     _XMDECN4() {};
1404     explicit _XMDECN4(UINT Packed) : v(Packed) {};
1405     _XMDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1406     explicit _XMDECN4(_In_count_c_(4) CONST FLOAT *pArray);
1407
1408     operator UINT () const { return v; }
1409
1410     _XMDECN4& operator= (CONST _XMDECN4& DecN4);
1411     _XMDECN4& operator= (CONST UINT Packed);
1412
1413 #endif // __cplusplus
1414
1415 } XMDECN4;
1416
1417 // 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer
1418 // The 4D Vector is packed into 32 bits as follows: a 2 bit signed, 
1419 // integer for the w component and 10 bit signed integers for the 
1420 // z, y, and x components.  The w component is stored in the 
1421 // most significant bits and the x component in the least significant bits
1422 // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
1423 typedef struct _XMDEC4
1424 {
1425     union
1426     {
1427         struct
1428         {
1429             INT  x   : 10;    // -511 to 511
1430             INT  y   : 10;    // -511 to 511
1431             INT  z   : 10;    // -511 to 511
1432             INT  w   : 2;     //   -1 to   1
1433         };
1434         UINT v;
1435     };
1436
1437 #ifdef __cplusplus
1438
1439     _XMDEC4() {};
1440     explicit _XMDEC4(UINT Packed) : v(Packed) {};
1441     _XMDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1442     explicit _XMDEC4(_In_count_c_(4) CONST FLOAT *pArray);
1443
1444     operator UINT () const { return v; }
1445
1446     _XMDEC4& operator= (CONST _XMDEC4& Dec4);
1447     _XMDEC4& operator= (CONST UINT Packed);
1448
1449 #endif // __cplusplus
1450
1451 } XMDEC4;
1452
1453 // 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer
1454 // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned, 
1455 // normalized integer for the w component and 10 bit unsigned, normalized 
1456 // integers for the z, y, and x components.  The w component is stored in the 
1457 // most significant bits and the x component in the least significant bits
1458 // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
1459 typedef struct _XMUDECN4
1460 {
1461     union
1462     {
1463         struct
1464         {
1465             UINT  x  : 10;    // 0/1023 to 1023/1023
1466             UINT  y  : 10;    // 0/1023 to 1023/1023
1467             UINT  z  : 10;    // 0/1023 to 1023/1023
1468             UINT  w  : 2;     //    0/3 to       3/3
1469         };
1470         UINT v;
1471     };
1472
1473 #ifdef __cplusplus
1474
1475     _XMUDECN4() {};
1476     explicit _XMUDECN4(UINT Packed) : v(Packed) {};
1477     _XMUDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1478     explicit _XMUDECN4(_In_count_c_(4) CONST FLOAT *pArray);
1479
1480     operator UINT () const { return v; }
1481
1482     _XMUDECN4& operator= (CONST _XMUDECN4& UDecN4);
1483     _XMUDECN4& operator= (CONST UINT Packed);
1484
1485 #endif // __cplusplus
1486
1487 } XMUDECN4;
1488
1489 // 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer
1490 // The 4D Vector is packed into 32 bits as follows: a 2 bit unsigned, 
1491 // integer for the w component and 10 bit unsigned integers 
1492 // for the z, y, and x components.  The w component is stored in the 
1493 // most significant bits and the x component in the least significant bits
1494 // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
1495 typedef struct _XMUDEC4
1496 {
1497     union
1498     {
1499         struct
1500         {
1501             UINT  x  : 10;    // 0 to 1023
1502             UINT  y  : 10;    // 0 to 1023
1503             UINT  z  : 10;    // 0 to 1023
1504             UINT  w  : 2;     // 0 to    3
1505         };
1506         UINT v;
1507     };
1508
1509 #ifdef __cplusplus
1510
1511     _XMUDEC4() {};
1512     explicit _XMUDEC4(UINT Packed) : v(Packed) {};
1513     _XMUDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1514     explicit _XMUDEC4(_In_count_c_(4) CONST FLOAT *pArray);
1515
1516     operator UINT () const { return v; }
1517
1518     _XMUDEC4& operator= (CONST _XMUDEC4& UDec4);
1519     _XMUDEC4& operator= (CONST UINT Packed);
1520
1521 #endif // __cplusplus
1522
1523 } XMUDEC4;
1524
1525 //------------------------------------------------------------------------------
1526 // 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer
1527 // The normalized 4D Vector is packed into 64 bits as follows: a 4 bit unsigned, 
1528 // normalized integer for the w component and 20 bit signed, normalized 
1529 // integers for the z, y, and x components.  The w component is stored in the 
1530 // most significant bits and the x component in the least significant bits
1531 // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
1532 typedef struct _XMXICON4
1533 {
1534     union
1535     {
1536         struct
1537         {
1538             INT64  x   : 20;    // -524287/524287 to 524287/524287
1539             INT64  y   : 20;    // -524287/524287 to 524287/524287
1540             INT64  z   : 20;    // -524287/524287 to 524287/524287
1541             UINT64 w   : 4;     //           0/15 to         15/15
1542         };
1543         UINT64 v;
1544     };
1545
1546 #ifdef __cplusplus
1547
1548     _XMXICON4() {};
1549     explicit _XMXICON4(UINT64 Packed) : v(Packed) {};
1550     _XMXICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1551     explicit _XMXICON4(_In_count_c_(4) CONST FLOAT *pArray);
1552
1553     operator UINT64 () const { return v; }
1554
1555     _XMXICON4& operator= (CONST _XMXICON4& XIcoN4);
1556     _XMXICON4& operator= (CONST UINT64 Packed);
1557
1558 #endif // __cplusplus
1559
1560 } XMXICON4;
1561
1562 // 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer
1563 // The 4D Vector is packed into 64 bits as follows: a 4 bit unsigned
1564 // integer for the w component and 20 bit signed integers for the 
1565 // z, y, and x components.  The w component is stored in the 
1566 // most significant bits and the x component in the least significant bits
1567 // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
1568 typedef struct _XMXICO4
1569 {
1570     union
1571     {
1572         struct
1573         {
1574             INT64  x   : 20;    // -524287 to 524287
1575             INT64  y   : 20;    // -524287 to 524287
1576             INT64  z   : 20;    // -524287 to 524287
1577             UINT64 w   : 4;     //       0 to     15
1578         };
1579         UINT64 v;
1580     };
1581
1582 #ifdef __cplusplus
1583
1584     _XMXICO4() {};
1585     explicit _XMXICO4(UINT64 Packed) : v(Packed) {};
1586     _XMXICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1587     explicit _XMXICO4(_In_count_c_(4) CONST FLOAT *pArray);
1588
1589     operator UINT64 () const { return v; }
1590
1591     _XMXICO4& operator= (CONST _XMXICO4& XIco4);
1592     _XMXICO4& operator= (CONST UINT64 Packed);
1593
1594 #endif // __cplusplus
1595
1596 } XMXICO4;
1597
1598 // 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer
1599 // The normalized 4D Vector is packed into 64 bits as follows: a 4 bit signed, 
1600 // normalized integer for the w component and 20 bit signed, normalized 
1601 // integers for the z, y, and x components.  The w component is stored in the 
1602 // most significant bits and the x component in the least significant bits
1603 // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
1604 typedef struct _XMICON4
1605 {
1606     union
1607     {
1608         struct
1609         {
1610             INT64  x   : 20;    // -524287/524287 to 524287/524287
1611             INT64  y   : 20;    // -524287/524287 to 524287/524287
1612             INT64  z   : 20;    // -524287/524287 to 524287/524287
1613             INT64  w   : 4;     //           -7/7 to           7/7
1614         };
1615         UINT64 v;
1616     };
1617
1618 #ifdef __cplusplus
1619
1620     _XMICON4() {};
1621     explicit _XMICON4(UINT64 Packed) : v(Packed) {};
1622     _XMICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1623     explicit _XMICON4(_In_count_c_(4) CONST FLOAT *pArray);
1624
1625     operator UINT64 () const { return v; }
1626
1627     _XMICON4& operator= (CONST _XMICON4& IcoN4);
1628     _XMICON4& operator= (CONST UINT64 Packed);
1629
1630 #endif // __cplusplus
1631
1632 } XMICON4;
1633
1634 // 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer
1635 // The 4D Vector is packed into 64 bits as follows: a 4 bit signed, 
1636 // integer for the w component and 20 bit signed integers for the 
1637 // z, y, and x components.  The w component is stored in the 
1638 // most significant bits and the x component in the least significant bits
1639 // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
1640 typedef struct _XMICO4
1641 {
1642     union
1643     {
1644         struct
1645         {
1646             INT64  x   : 20;    // -524287 to 524287
1647             INT64  y   : 20;    // -524287 to 524287
1648             INT64  z   : 20;    // -524287 to 524287
1649             INT64  w   : 4;     //      -7 to      7
1650         };
1651         UINT64 v;
1652     };
1653
1654 #ifdef __cplusplus
1655
1656     _XMICO4() {};
1657     explicit _XMICO4(UINT64 Packed) : v(Packed) {};
1658     _XMICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1659     explicit _XMICO4(_In_count_c_(4) CONST FLOAT *pArray);
1660
1661     operator UINT64 () const { return v; }
1662
1663     _XMICO4& operator= (CONST _XMICO4& Ico4);
1664     _XMICO4& operator= (CONST UINT64 Packed);
1665
1666 #endif // __cplusplus
1667
1668 } XMICO4;
1669
1670 // 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer
1671 // The normalized 4D Vector is packed into 64 bits as follows: a 4 bit unsigned, 
1672 // normalized integer for the w component and 20 bit unsigned, normalized 
1673 // integers for the z, y, and x components.  The w component is stored in the 
1674 // most significant bits and the x component in the least significant bits
1675 // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
1676 typedef struct _XMUICON4
1677 {
1678     union
1679     {
1680         struct
1681         {
1682             UINT64  x  : 20;    // 0/1048575 to 1048575/1048575
1683             UINT64  y  : 20;    // 0/1048575 to 1048575/1048575
1684             UINT64  z  : 20;    // 0/1048575 to 1048575/1048575
1685             UINT64  w  : 4;     //      0/15 to           15/15
1686         };
1687         UINT64 v;
1688     };
1689
1690 #ifdef __cplusplus
1691
1692     _XMUICON4() {};
1693     explicit _XMUICON4(UINT64 Packed) : v(Packed) {};
1694     _XMUICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1695     explicit _XMUICON4(_In_count_c_(4) CONST FLOAT *pArray);
1696
1697     operator UINT64 () const { return v; }
1698
1699     _XMUICON4& operator= (CONST _XMUICON4& UIcoN4);
1700     _XMUICON4& operator= (CONST UINT64 Packed);
1701
1702 #endif // __cplusplus
1703
1704 } XMUICON4;
1705
1706 // 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer
1707 // The 4D Vector is packed into 64 bits as follows: a 4 bit unsigned 
1708 // integer for the w component and 20 bit unsigned integers for the 
1709 // z, y, and x components.  The w component is stored in the 
1710 // most significant bits and the x component in the least significant bits
1711 // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
1712 typedef struct _XMUICO4
1713 {
1714     union
1715     {
1716         struct
1717         {
1718             UINT64  x  : 20;    // 0 to 1048575
1719             UINT64  y  : 20;    // 0 to 1048575
1720             UINT64  z  : 20;    // 0 to 1048575
1721             UINT64  w  : 4;     // 0 to      15
1722         };
1723         UINT64 v;
1724     };
1725
1726 #ifdef __cplusplus
1727
1728     _XMUICO4() {};
1729     explicit _XMUICO4(UINT64 Packed) : v(Packed) {};
1730     _XMUICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1731     explicit _XMUICO4(_In_count_c_(4) CONST FLOAT *pArray);
1732
1733     operator UINT64 () const { return v; }
1734
1735     _XMUICO4& operator= (CONST _XMUICO4& UIco4);
1736     _XMUICO4& operator= (CONST UINT64 Packed);
1737
1738 #endif // __cplusplus
1739
1740 } XMUICO4;
1741
1742 //------------------------------------------------------------------------------
1743 // ARGB Color; 8-8-8-8 bit unsigned normalized integer components packed into
1744 // a 32 bit integer.  The normalized color is packed into 32 bits using 8 bit
1745 // unsigned, normalized integers for the alpha, red, green, and blue components.
1746 // The alpha component is stored in the most significant bits and the blue
1747 // component in the least significant bits (A8R8G8B8):
1748 // [32] aaaaaaaa rrrrrrrr gggggggg bbbbbbbb [0]
1749 typedef struct _XMCOLOR
1750 {
1751     union
1752     {
1753         struct
1754         {
1755             UINT b    : 8;  // Blue:    0/255 to 255/255
1756             UINT g    : 8;  // Green:   0/255 to 255/255
1757             UINT r    : 8;  // Red:     0/255 to 255/255
1758             UINT a    : 8;  // Alpha:   0/255 to 255/255
1759         };
1760         UINT c;
1761     };
1762
1763 #ifdef __cplusplus
1764
1765     _XMCOLOR() {};
1766     _XMCOLOR(UINT Color) : c(Color) {};
1767     _XMCOLOR(FLOAT _r, FLOAT _g, FLOAT _b, FLOAT _a);
1768     explicit _XMCOLOR(_In_count_c_(4) CONST FLOAT *pArray);
1769
1770     operator UINT () const { return c; }
1771
1772     _XMCOLOR& operator= (CONST _XMCOLOR& Color);
1773     _XMCOLOR& operator= (CONST UINT Color);
1774
1775 #endif // __cplusplus
1776
1777 } XMCOLOR;
1778
1779 //------------------------------------------------------------------------------
1780 // 4D Vector; 8 bit signed normalized integer components
1781 typedef struct _XMBYTEN4
1782 {
1783     union
1784     {
1785         struct
1786         {
1787             CHAR x;
1788             CHAR y;
1789             CHAR z;
1790             CHAR w;
1791         };
1792         UINT v;
1793     };
1794
1795 #ifdef __cplusplus
1796
1797     _XMBYTEN4() {};
1798     _XMBYTEN4(CHAR _x, CHAR _y, CHAR _z, CHAR _w) : x(_x), y(_y), z(_z), w(_w) {};
1799     explicit _XMBYTEN4(UINT Packed) : v(Packed) {};
1800     explicit _XMBYTEN4(_In_count_c_(4) CONST CHAR *pArray);
1801     _XMBYTEN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1802     explicit _XMBYTEN4(_In_count_c_(4) CONST FLOAT *pArray);
1803
1804     _XMBYTEN4& operator= (CONST _XMBYTEN4& ByteN4);
1805     _XMBYTEN4& operator= (UINT Packed) { v = Packed; return *this; }
1806
1807 #endif // __cplusplus
1808
1809 } XMBYTEN4;
1810
1811 // 4D Vector; 8 bit signed integer components
1812 typedef struct _XMBYTE4
1813 {
1814     union
1815     {
1816         struct
1817         {
1818             CHAR x;
1819             CHAR y;
1820             CHAR z;
1821             CHAR w;
1822         };
1823         UINT v;
1824     };
1825
1826 #ifdef __cplusplus
1827
1828     _XMBYTE4() {};
1829     _XMBYTE4(CHAR _x, CHAR _y, CHAR _z, CHAR _w) : x(_x), y(_y), z(_z), w(_w) {};
1830     explicit _XMBYTE4(UINT Packed) : v(Packed) {};
1831     explicit _XMBYTE4(_In_count_c_(4) CONST CHAR *pArray);
1832     _XMBYTE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1833     explicit _XMBYTE4(_In_count_c_(4) CONST FLOAT *pArray);
1834
1835     _XMBYTE4& operator= (CONST _XMBYTE4& Byte4);
1836     _XMBYTE4& operator= (UINT Packed) { v = Packed; return *this; }
1837
1838 #endif // __cplusplus
1839
1840 } XMBYTE4;
1841
1842 // 4D Vector; 8 bit unsigned normalized integer components
1843 typedef struct _XMUBYTEN4
1844 {
1845     union
1846     {
1847         struct
1848         {
1849             BYTE x;
1850             BYTE y;
1851             BYTE z;
1852             BYTE w;
1853         };
1854         UINT v;
1855     };
1856
1857 #ifdef __cplusplus
1858
1859     _XMUBYTEN4() {};
1860     _XMUBYTEN4(BYTE _x, BYTE _y, BYTE _z, BYTE _w) : x(_x), y(_y), z(_z), w(_w) {};
1861     explicit _XMUBYTEN4(UINT Packed) : v(Packed) {};
1862     explicit _XMUBYTEN4(_In_count_c_(4) CONST BYTE *pArray);
1863     _XMUBYTEN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1864     explicit _XMUBYTEN4(_In_count_c_(4) CONST FLOAT *pArray);
1865
1866     _XMUBYTEN4& operator= (CONST _XMUBYTEN4& UByteN4);
1867     _XMUBYTEN4& operator= (UINT Packed) { v = Packed; return *this; }
1868
1869 #endif // __cplusplus
1870
1871 } XMUBYTEN4;
1872
1873 // 4D Vector; 8 bit unsigned integer components
1874 typedef struct _XMUBYTE4
1875 {
1876     union
1877     {
1878         struct
1879         {
1880             BYTE x;
1881             BYTE y;
1882             BYTE z;
1883             BYTE w;
1884         };
1885         UINT v;
1886     };
1887
1888 #ifdef __cplusplus
1889
1890     _XMUBYTE4() {};
1891     _XMUBYTE4(BYTE _x, BYTE _y, BYTE _z, BYTE _w) : x(_x), y(_y), z(_z), w(_w) {};
1892     explicit _XMUBYTE4(UINT Packed) : v(Packed) {};
1893     explicit _XMUBYTE4(_In_count_c_(4) CONST BYTE *pArray);
1894     _XMUBYTE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1895     explicit _XMUBYTE4(_In_count_c_(4) CONST FLOAT *pArray);
1896
1897     _XMUBYTE4& operator= (CONST _XMUBYTE4& UByte4);
1898     _XMUBYTE4& operator= (UINT Packed) { v = Packed; return *this; }
1899
1900 #endif // __cplusplus
1901
1902 } XMUBYTE4;
1903
1904 //------------------------------------------------------------------------------
1905 // 4D vector; 4 bit unsigned integer components
1906 typedef struct _XMUNIBBLE4
1907 {
1908     union
1909     {
1910         struct
1911         {
1912             USHORT x  : 4;
1913             USHORT y  : 4;
1914             USHORT z  : 4;
1915             USHORT w  : 4;
1916         };
1917         USHORT v;
1918     };
1919
1920 #ifdef __cplusplus
1921
1922     _XMUNIBBLE4() {};
1923     explicit _XMUNIBBLE4(USHORT Packed) : v(Packed) {};
1924     _XMUNIBBLE4(CHAR _x, CHAR _y, CHAR _z, CHAR _w) : x(_x), y(_y), z(_z), w(_w) {};
1925     explicit _XMUNIBBLE4(_In_count_c_(4) CONST CHAR *pArray);
1926     _XMUNIBBLE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1927     explicit _XMUNIBBLE4(_In_count_c_(4) CONST FLOAT *pArray);
1928
1929     operator USHORT () const { return v; }
1930
1931     _XMUNIBBLE4& operator= (CONST _XMUNIBBLE4& UNibble4);
1932     _XMUNIBBLE4& operator= (CONST USHORT Packed);
1933
1934 #endif // __cplusplus
1935
1936 } XMUNIBBLE4;
1937
1938 //------------------------------------------------------------------------------
1939 // 4D vector: 5/5/5/1 unsigned integer components
1940 typedef struct _XMU555
1941 {
1942     union
1943     {
1944         struct
1945         {
1946             USHORT x  : 5;
1947             USHORT y  : 5;
1948             USHORT z  : 5;
1949             USHORT w  : 1;
1950         };
1951         USHORT v;
1952     };
1953
1954 #ifdef __cplusplus
1955
1956     _XMU555() {};
1957     explicit _XMU555(USHORT Packed) : v(Packed) {};
1958     _XMU555(CHAR _x, CHAR _y, CHAR _z, BOOL _w) : x(_x), y(_y), z(_z), w(_w ? 0x1 : 0) {};
1959     _XMU555(_In_count_c_(3) CONST CHAR *pArray, BOOL _w);
1960     _XMU555(FLOAT _x, FLOAT _y, FLOAT _z, BOOL _w);
1961     _XMU555(_In_count_c_(3) CONST FLOAT *pArray, BOOL _w);
1962
1963     operator USHORT () const { return v; }
1964
1965     _XMU555& operator= (CONST _XMU555& U555);
1966     _XMU555& operator= (CONST USHORT Packed);
1967
1968 #endif // __cplusplus
1969
1970 } XMU555;
1971
1972 //------------------------------------------------------------------------------
1973 // 3x3 Matrix: 32 bit floating point components
1974 typedef struct _XMFLOAT3X3
1975 {
1976     union
1977     {
1978         struct
1979         {
1980             FLOAT _11, _12, _13;
1981             FLOAT _21, _22, _23;
1982             FLOAT _31, _32, _33;
1983         };
1984         FLOAT m[3][3];
1985     };
1986
1987 #ifdef __cplusplus
1988
1989     _XMFLOAT3X3() {};
1990     _XMFLOAT3X3(FLOAT m00, FLOAT m01, FLOAT m02,
1991                 FLOAT m10, FLOAT m11, FLOAT m12,
1992                 FLOAT m20, FLOAT m21, FLOAT m22);
1993     explicit _XMFLOAT3X3(_In_count_c_(9) CONST FLOAT *pArray);
1994
1995     FLOAT       operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
1996     FLOAT&      operator() (UINT Row, UINT Column) { return m[Row][Column]; }
1997
1998     _XMFLOAT3X3& operator= (CONST _XMFLOAT3X3& Float3x3);
1999
2000 #endif // __cplusplus
2001
2002 } XMFLOAT3X3;
2003
2004 //------------------------------------------------------------------------------
2005 // 4x3 Matrix: 32 bit floating point components
2006 typedef struct _XMFLOAT4X3
2007 {
2008     union
2009     {
2010         struct
2011         {
2012             FLOAT _11, _12, _13;
2013             FLOAT _21, _22, _23;
2014             FLOAT _31, _32, _33;
2015             FLOAT _41, _42, _43;
2016         };
2017         FLOAT m[4][3];
2018     };
2019
2020 #ifdef __cplusplus
2021
2022     _XMFLOAT4X3() {};
2023     _XMFLOAT4X3(FLOAT m00, FLOAT m01, FLOAT m02,
2024                 FLOAT m10, FLOAT m11, FLOAT m12,
2025                 FLOAT m20, FLOAT m21, FLOAT m22,
2026                 FLOAT m30, FLOAT m31, FLOAT m32);
2027     explicit _XMFLOAT4X3(_In_count_c_(12) CONST FLOAT *pArray);
2028
2029     FLOAT       operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
2030     FLOAT&      operator() (UINT Row, UINT Column) { return m[Row][Column]; }
2031
2032     _XMFLOAT4X3& operator= (CONST _XMFLOAT4X3& Float4x3);
2033
2034 #endif // __cplusplus
2035
2036 } XMFLOAT4X3;
2037
2038 // 4x3 Matrix: 32 bit floating point components aligned on a 16 byte boundary
2039 #ifdef __cplusplus
2040 __declspec(align(16)) struct XMFLOAT4X3A : public XMFLOAT4X3
2041 {
2042     XMFLOAT4X3A() : XMFLOAT4X3() {};
2043     XMFLOAT4X3A(FLOAT m00, FLOAT m01, FLOAT m02,
2044                 FLOAT m10, FLOAT m11, FLOAT m12,
2045                 FLOAT m20, FLOAT m21, FLOAT m22,
2046                 FLOAT m30, FLOAT m31, FLOAT m32) :
2047         XMFLOAT4X3(m00,m01,m02,m10,m11,m12,m20,m21,m22,m30,m31,m32) {};
2048     explicit XMFLOAT4X3A(_In_count_c_(12) CONST FLOAT *pArray) : XMFLOAT4X3(pArray) {}
2049
2050     FLOAT       operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
2051     FLOAT&      operator() (UINT Row, UINT Column) { return m[Row][Column]; }
2052
2053     XMFLOAT4X3A& operator= (CONST XMFLOAT4X3A& Float4x3);
2054 };
2055 #else
2056 typedef __declspec(align(16)) XMFLOAT4X3 XMFLOAT4X3A;
2057 #endif // __cplusplus
2058
2059 //------------------------------------------------------------------------------
2060 // 4x4 Matrix: 32 bit floating point components
2061 typedef struct _XMFLOAT4X4
2062 {
2063     union
2064     {
2065         struct
2066         {
2067             FLOAT _11, _12, _13, _14;
2068             FLOAT _21, _22, _23, _24;
2069             FLOAT _31, _32, _33, _34;
2070             FLOAT _41, _42, _43, _44;
2071         };
2072         FLOAT m[4][4];
2073     };
2074
2075 #ifdef __cplusplus
2076
2077     _XMFLOAT4X4() {};
2078     _XMFLOAT4X4(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
2079                 FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
2080                 FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
2081                 FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33);
2082     explicit _XMFLOAT4X4(_In_count_c_(16) CONST FLOAT *pArray);
2083
2084     FLOAT       operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
2085     FLOAT&      operator() (UINT Row, UINT Column) { return m[Row][Column]; }
2086
2087     _XMFLOAT4X4& operator= (CONST _XMFLOAT4X4& Float4x4);
2088
2089 #endif // __cplusplus
2090
2091 } XMFLOAT4X4;
2092
2093 // 4x4 Matrix: 32 bit floating point components aligned on a 16 byte boundary
2094 #ifdef __cplusplus
2095 __declspec(align(16)) struct XMFLOAT4X4A : public XMFLOAT4X4
2096 {
2097     XMFLOAT4X4A() : XMFLOAT4X4() {};
2098     XMFLOAT4X4A(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
2099                 FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
2100                 FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
2101                 FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33)
2102         : XMFLOAT4X4(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33) {};
2103     explicit XMFLOAT4X4A(_In_count_c_(16) CONST FLOAT *pArray) : XMFLOAT4X4(pArray) {}
2104
2105     FLOAT       operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
2106     FLOAT&      operator() (UINT Row, UINT Column) { return m[Row][Column]; }
2107
2108     XMFLOAT4X4A& operator= (CONST XMFLOAT4X4A& Float4x4);
2109 };
2110 #else
2111 typedef __declspec(align(16)) XMFLOAT4X4 XMFLOAT4X4A;
2112 #endif // __cplusplus
2113
2114
2115 #ifdef _XM_BIGENDIAN_
2116 #pragma bitfield_order(pop)
2117 #endif
2118
2119 #pragma warning(pop)
2120
2121 /****************************************************************************
2122  *
2123  * Data conversion operations
2124  *
2125  ****************************************************************************/
2126
2127 #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_)
2128 #else
2129 XMVECTOR        XMConvertVectorIntToFloat(FXMVECTOR VInt, UINT DivExponent);
2130 XMVECTOR        XMConvertVectorFloatToInt(FXMVECTOR VFloat, UINT MulExponent);
2131 XMVECTOR        XMConvertVectorUIntToFloat(FXMVECTOR VUInt, UINT DivExponent);
2132 XMVECTOR        XMConvertVectorFloatToUInt(FXMVECTOR VFloat, UINT MulExponent);
2133 #endif
2134
2135 FLOAT           XMConvertHalfToFloat(HALF Value);
2136 FLOAT*          XMConvertHalfToFloatStream(_Out_bytecap_x_(sizeof(FLOAT)+OutputStride*(HalfCount-1)) FLOAT* pOutputStream,
2137                                            _In_ size_t OutputStride,
2138                                            _In_bytecount_x_(sizeof(HALF)+InputStride*(HalfCount-1)) CONST HALF* pInputStream,
2139                                            _In_ size_t InputStride, _In_ size_t HalfCount);
2140 HALF            XMConvertFloatToHalf(FLOAT Value);
2141 HALF*           XMConvertFloatToHalfStream(_Out_bytecap_x_(sizeof(HALF)+OutputStride*(FloatCount-1)) HALF* pOutputStream,
2142                                            _In_ size_t OutputStride,
2143                                            _In_bytecount_x_(sizeof(FLOAT)+InputStride*(FloatCount-1)) CONST FLOAT* pInputStream,
2144                                            _In_ size_t InputStride, _In_ size_t FloatCount);
2145
2146 #if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_)
2147 XMVECTOR XMVectorSetBinaryConstant(UINT C0, UINT C1, UINT C2, UINT C3);
2148 XMVECTOR XMVectorSplatConstant(INT IntConstant, UINT DivExponent);
2149 XMVECTOR XMVectorSplatConstantInt(INT IntConstant);
2150
2151 // VMX128 versions defined below as macros
2152 #endif
2153
2154 /****************************************************************************
2155  *
2156  * Load operations
2157  *
2158  ****************************************************************************/
2159
2160 XMVECTOR        XMLoadInt(_In_ CONST UINT* pSource);
2161 XMVECTOR        XMLoadFloat(_In_ CONST FLOAT* pSource);
2162
2163 XMVECTOR        XMLoadInt2(_In_count_c_(2) CONST UINT* pSource);
2164 XMVECTOR        XMLoadInt2A(_In_count_c_(2) CONST UINT* PSource);
2165 XMVECTOR        XMLoadFloat2(_In_ CONST XMFLOAT2* pSource);
2166 XMVECTOR        XMLoadFloat2A(_In_ CONST XMFLOAT2A* pSource);
2167 XMVECTOR        XMLoadSInt2(_In_ CONST XMINT2* pSource);
2168 XMVECTOR        XMLoadUInt2(_In_ CONST XMUINT2* pSource);
2169 XMVECTOR        XMLoadHalf2(_In_ CONST XMHALF2* pSource);
2170 XMVECTOR        XMLoadShortN2(_In_ CONST XMSHORTN2* pSource);
2171 XMVECTOR        XMLoadShort2(_In_ CONST XMSHORT2* pSource);
2172 XMVECTOR        XMLoadUShortN2(_In_ CONST XMUSHORTN2* pSource);
2173 XMVECTOR        XMLoadUShort2(_In_ CONST XMUSHORT2* pSource);
2174 XMVECTOR        XMLoadByteN2(_In_ CONST XMBYTEN2* pSource);
2175 XMVECTOR        XMLoadByte2(_In_ CONST XMBYTE2* pSource);
2176 XMVECTOR        XMLoadUByteN2(_In_ CONST XMUBYTEN2* pSource);
2177 XMVECTOR        XMLoadUByte2(_In_ CONST XMUBYTE2* pSource);
2178
2179 XMVECTOR        XMLoadInt3(_In_count_c_(3) CONST UINT* pSource);
2180 XMVECTOR        XMLoadInt3A(_In_count_c_(3) CONST UINT* pSource);
2181 XMVECTOR        XMLoadFloat3(_In_ CONST XMFLOAT3* pSource);
2182 XMVECTOR        XMLoadFloat3A(_In_ CONST XMFLOAT3A* pSource);
2183 XMVECTOR        XMLoadSInt3(_In_ CONST XMINT3* pSource);
2184 XMVECTOR        XMLoadUInt3(_In_ CONST XMUINT3* pSource);
2185 XMVECTOR        XMLoadHenDN3(_In_ CONST XMHENDN3* pSource);
2186 XMVECTOR        XMLoadHenD3(_In_ CONST XMHEND3* pSource);
2187 XMVECTOR        XMLoadUHenDN3(_In_ CONST XMUHENDN3* pSource);
2188 XMVECTOR        XMLoadUHenD3(_In_ CONST XMUHEND3* pSource);
2189 XMVECTOR        XMLoadDHenN3(_In_ CONST XMDHENN3* pSource);
2190 XMVECTOR        XMLoadDHen3(_In_ CONST XMDHEN3* pSource);
2191 XMVECTOR        XMLoadUDHenN3(_In_ CONST XMUDHENN3* pSource);
2192 XMVECTOR        XMLoadUDHen3(_In_ CONST XMUDHEN3* pSource);
2193 XMVECTOR        XMLoadU565(_In_ CONST XMU565* pSource);
2194 XMVECTOR        XMLoadFloat3PK(_In_ CONST XMFLOAT3PK* pSource);
2195 XMVECTOR        XMLoadFloat3SE(_In_ CONST XMFLOAT3SE* pSource);
2196
2197 XMVECTOR        XMLoadInt4(_In_count_c_(4) CONST UINT* pSource);
2198 XMVECTOR        XMLoadInt4A(_In_count_c_(4) CONST UINT* pSource);
2199 XMVECTOR        XMLoadFloat4(_In_ CONST XMFLOAT4* pSource);
2200 XMVECTOR        XMLoadFloat4A(_In_ CONST XMFLOAT4A* pSource);
2201 XMVECTOR        XMLoadSInt4(_In_ CONST XMINT4* pSource);
2202 XMVECTOR        XMLoadUInt4(_In_ CONST XMUINT4* pSource);
2203 XMVECTOR        XMLoadHalf4(_In_ CONST XMHALF4* pSource);
2204 XMVECTOR        XMLoadShortN4(_In_ CONST XMSHORTN4* pSource);
2205 XMVECTOR        XMLoadShort4(_In_ CONST XMSHORT4* pSource);
2206 XMVECTOR        XMLoadUShortN4(_In_ CONST XMUSHORTN4* pSource);
2207 XMVECTOR        XMLoadUShort4(_In_ CONST XMUSHORT4* pSource);
2208 XMVECTOR        XMLoadXIcoN4(_In_ CONST XMXICON4* pSource);
2209 XMVECTOR        XMLoadXIco4(_In_ CONST XMXICO4* pSource);
2210 XMVECTOR        XMLoadIcoN4(_In_ CONST XMICON4* pSource);
2211 XMVECTOR        XMLoadIco4(_In_ CONST XMICO4* pSource);
2212 XMVECTOR        XMLoadUIcoN4(_In_ CONST XMUICON4* pSource);
2213 XMVECTOR        XMLoadUIco4(_In_ CONST XMUICO4* pSource);
2214 XMVECTOR        XMLoadXDecN4(_In_ CONST XMXDECN4* pSource);
2215 XMVECTOR        XMLoadXDec4(_In_ CONST XMXDEC4* pSource);
2216 XMVECTOR        XMLoadDecN4(_In_ CONST XMDECN4* pSource);
2217 XMVECTOR        XMLoadDec4(_In_ CONST XMDEC4* pSource);
2218 XMVECTOR        XMLoadUDecN4(_In_ CONST XMUDECN4* pSource);
2219 XMVECTOR        XMLoadUDec4(_In_ CONST XMUDEC4* pSource);
2220 XMVECTOR        XMLoadByteN4(_In_ CONST XMBYTEN4* pSource);
2221 XMVECTOR        XMLoadByte4(_In_ CONST XMBYTE4* pSource);
2222 XMVECTOR        XMLoadUByteN4(_In_ CONST XMUBYTEN4* pSource);
2223 XMVECTOR        XMLoadUByte4(_In_ CONST XMUBYTE4* pSource);
2224 XMVECTOR        XMLoadUNibble4(_In_ CONST XMUNIBBLE4* pSource);
2225 XMVECTOR        XMLoadU555(_In_ CONST XMU555* pSource);
2226 XMVECTOR        XMLoadColor(_In_ CONST XMCOLOR* pSource);
2227
2228 XMMATRIX        XMLoadFloat3x3(_In_ CONST XMFLOAT3X3* pSource);
2229 XMMATRIX        XMLoadFloat4x3(_In_ CONST XMFLOAT4X3* pSource);
2230 XMMATRIX        XMLoadFloat4x3A(_In_ CONST XMFLOAT4X3A* pSource);
2231 XMMATRIX        XMLoadFloat4x4(_In_ CONST XMFLOAT4X4* pSource);
2232 XMMATRIX        XMLoadFloat4x4A(_In_ CONST XMFLOAT4X4A* pSource);
2233
2234 /****************************************************************************
2235  *
2236  * Store operations
2237  *
2238  ****************************************************************************/
2239
2240 VOID            XMStoreInt(_Out_ UINT* pDestination, FXMVECTOR V);
2241 VOID            XMStoreFloat(_Out_ FLOAT* pDestination, FXMVECTOR V);
2242
2243 VOID            XMStoreInt2(_Out_cap_c_(2) UINT* pDestination, FXMVECTOR V);
2244 VOID            XMStoreInt2A(_Out_cap_c_(2) UINT* pDestination, FXMVECTOR V);
2245 VOID            XMStoreFloat2(_Out_ XMFLOAT2* pDestination, FXMVECTOR V);
2246 VOID            XMStoreFloat2A(_Out_ XMFLOAT2A* pDestination, FXMVECTOR V);
2247 VOID            XMStoreSInt2(_Out_ XMINT2* pDestination, FXMVECTOR V);
2248 VOID            XMStoreUInt2(_Out_ XMUINT2* pDestination, FXMVECTOR V);
2249 VOID            XMStoreHalf2(_Out_ XMHALF2* pDestination, FXMVECTOR V);
2250 VOID            XMStoreShortN2(_Out_ XMSHORTN2* pDestination, FXMVECTOR V);
2251 VOID            XMStoreShort2(_Out_ XMSHORT2* pDestination, FXMVECTOR V);
2252 VOID            XMStoreUShortN2(_Out_ XMUSHORTN2* pDestination, FXMVECTOR V);
2253 VOID            XMStoreUShort2(_Out_ XMUSHORT2* pDestination, FXMVECTOR V);
2254 VOID            XMStoreByteN2(_Out_ XMBYTEN2* pDestination, FXMVECTOR V);
2255 VOID            XMStoreByte2(_Out_ XMBYTE2* pDestination, FXMVECTOR V);
2256 VOID            XMStoreUByteN2(_Out_ XMUBYTEN2* pDestination, FXMVECTOR V);
2257 VOID            XMStoreUByte2(_Out_ XMUBYTE2* pDestination, FXMVECTOR V);
2258
2259 VOID            XMStoreInt3(_Out_cap_c_(3) UINT* pDestination, FXMVECTOR V);
2260 VOID            XMStoreInt3A(_Out_cap_c_(3) UINT* pDestination, FXMVECTOR V);
2261 VOID            XMStoreFloat3(_Out_ XMFLOAT3* pDestination, FXMVECTOR V);
2262 VOID            XMStoreFloat3A(_Out_ XMFLOAT3A* pDestination, FXMVECTOR V);
2263 VOID            XMStoreSInt3(_Out_ XMINT3* pDestination, FXMVECTOR V);
2264 VOID            XMStoreUInt3(_Out_ XMUINT3* pDestination, FXMVECTOR V);
2265 VOID            XMStoreHenDN3(_Out_ XMHENDN3* pDestination, FXMVECTOR V);
2266 VOID            XMStoreHenD3(_Out_ XMHEND3* pDestination, FXMVECTOR V);
2267 VOID            XMStoreUHenDN3(_Out_ XMUHENDN3* pDestination, FXMVECTOR V);
2268 VOID            XMStoreUHenD3(_Out_ XMUHEND3* pDestination, FXMVECTOR V);
2269 VOID            XMStoreDHenN3(_Out_ XMDHENN3* pDestination, FXMVECTOR V);
2270 VOID            XMStoreDHen3(_Out_ XMDHEN3* pDestination, FXMVECTOR V);
2271 VOID            XMStoreUDHenN3(_Out_ XMUDHENN3* pDestination, FXMVECTOR V);
2272 VOID            XMStoreUDHen3(_Out_ XMUDHEN3* pDestination, FXMVECTOR V);
2273 VOID            XMStoreU565(_Out_ XMU565* pDestination, FXMVECTOR V);
2274 VOID            XMStoreFloat3PK(_Out_ XMFLOAT3PK* pDestination, FXMVECTOR V);
2275 VOID            XMStoreFloat3SE(_Out_ XMFLOAT3SE* pDestination, FXMVECTOR V);
2276
2277 VOID            XMStoreInt4(_Out_cap_c_(4) UINT* pDestination, FXMVECTOR V);
2278 VOID            XMStoreInt4A(_Out_cap_c_(4) UINT* pDestination, FXMVECTOR V);
2279 VOID            XMStoreInt4NC(_Out_cap_c_(4) UINT* pDestination, FXMVECTOR V);
2280 VOID            XMStoreFloat4(_Out_ XMFLOAT4* pDestination, FXMVECTOR V);
2281 VOID            XMStoreFloat4A(_Out_ XMFLOAT4A* pDestination, FXMVECTOR V);
2282 VOID            XMStoreFloat4NC(_Out_ XMFLOAT4* pDestination, FXMVECTOR V);
2283 VOID            XMStoreSInt4(_Out_ XMINT4* pDestination, FXMVECTOR V);
2284 VOID            XMStoreUInt4(_Out_ XMUINT4* pDestination, FXMVECTOR V);
2285 VOID            XMStoreHalf4(_Out_ XMHALF4* pDestination, FXMVECTOR V);
2286 VOID            XMStoreShortN4(_Out_ XMSHORTN4* pDestination, FXMVECTOR V);
2287 VOID            XMStoreShort4(_Out_ XMSHORT4* pDestination, FXMVECTOR V);
2288 VOID            XMStoreUShortN4(_Out_ XMUSHORTN4* pDestination, FXMVECTOR V);
2289 VOID            XMStoreUShort4(_Out_ XMUSHORT4* pDestination, FXMVECTOR V);
2290 VOID            XMStoreXIcoN4(_Out_ XMXICON4* pDestination, FXMVECTOR V);
2291 VOID            XMStoreXIco4(_Out_ XMXICO4* pDestination, FXMVECTOR V);
2292 VOID            XMStoreIcoN4(_Out_ XMICON4* pDestination, FXMVECTOR V);
2293 VOID            XMStoreIco4(_Out_ XMICO4* pDestination, FXMVECTOR V);
2294 VOID            XMStoreUIcoN4(_Out_ XMUICON4* pDestination, FXMVECTOR V);
2295 VOID            XMStoreUIco4(_Out_ XMUICO4* pDestination, FXMVECTOR V);
2296 VOID            XMStoreXDecN4(_Out_ XMXDECN4* pDestination, FXMVECTOR V);
2297 VOID            XMStoreXDec4(_Out_ XMXDEC4* pDestination, FXMVECTOR V);
2298 VOID            XMStoreDecN4(_Out_ XMDECN4* pDestination, FXMVECTOR V);
2299 VOID            XMStoreDec4(_Out_ XMDEC4* pDestination, FXMVECTOR V);
2300 VOID            XMStoreUDecN4(_Out_ XMUDECN4* pDestination, FXMVECTOR V);
2301 VOID            XMStoreUDec4(_Out_ XMUDEC4* pDestination, FXMVECTOR V);
2302 VOID            XMStoreByteN4(_Out_ XMBYTEN4* pDestination, FXMVECTOR V);
2303 VOID            XMStoreByte4(_Out_ XMBYTE4* pDestination, FXMVECTOR V);
2304 VOID            XMStoreUByteN4(_Out_ XMUBYTEN4* pDestination, FXMVECTOR V);
2305 VOID            XMStoreUByte4(_Out_ XMUBYTE4* pDestination, FXMVECTOR V);
2306 VOID            XMStoreUNibble4(_Out_ XMUNIBBLE4* pDestination, FXMVECTOR V);
2307 VOID            XMStoreU555(_Out_ XMU555* pDestination, FXMVECTOR V);
2308 VOID            XMStoreColor(_Out_ XMCOLOR* pDestination, FXMVECTOR V);
2309
2310 VOID            XMStoreFloat3x3(_Out_ XMFLOAT3X3* pDestination, CXMMATRIX M);
2311 VOID            XMStoreFloat3x3NC(_Out_ XMFLOAT3X3* pDestination, CXMMATRIX M);
2312 VOID            XMStoreFloat4x3(_Out_ XMFLOAT4X3* pDestination, CXMMATRIX M);
2313 VOID            XMStoreFloat4x3A(_Out_ XMFLOAT4X3A* pDestination, CXMMATRIX M);
2314 VOID            XMStoreFloat4x3NC(_Out_ XMFLOAT4X3* pDestination, CXMMATRIX M);
2315 VOID            XMStoreFloat4x4(_Out_ XMFLOAT4X4* pDestination, CXMMATRIX M);
2316 VOID            XMStoreFloat4x4A(_Out_ XMFLOAT4X4A* pDestination, CXMMATRIX M);
2317 VOID            XMStoreFloat4x4NC(_Out_ XMFLOAT4X4* pDestination, CXMMATRIX M);
2318
2319 /****************************************************************************
2320  *
2321  * General vector operations
2322  *
2323  ****************************************************************************/
2324
2325 XMVECTOR        XMVectorZero();
2326 XMVECTOR        XMVectorSet(FLOAT x, FLOAT y, FLOAT z, FLOAT w);
2327 XMVECTOR        XMVectorSetInt(UINT x, UINT y, UINT z, UINT w);
2328 XMVECTOR        XMVectorReplicate(FLOAT Value);
2329 XMVECTOR        XMVectorReplicatePtr(_In_ CONST FLOAT *pValue);
2330 XMVECTOR        XMVectorReplicateInt(UINT Value);
2331 XMVECTOR        XMVectorReplicateIntPtr(_In_ CONST UINT *pValue);
2332 XMVECTOR        XMVectorTrueInt();
2333 XMVECTOR        XMVectorFalseInt();
2334 XMVECTOR        XMVectorSplatX(FXMVECTOR V);
2335 XMVECTOR        XMVectorSplatY(FXMVECTOR V);
2336 XMVECTOR        XMVectorSplatZ(FXMVECTOR V);
2337 XMVECTOR        XMVectorSplatW(FXMVECTOR V);
2338 XMVECTOR        XMVectorSplatOne();
2339 XMVECTOR        XMVectorSplatInfinity();
2340 XMVECTOR        XMVectorSplatQNaN();
2341 XMVECTOR        XMVectorSplatEpsilon();
2342 XMVECTOR        XMVectorSplatSignMask();
2343
2344 FLOAT           XMVectorGetByIndex(FXMVECTOR V,UINT i);
2345 FLOAT           XMVectorGetX(FXMVECTOR V);
2346 FLOAT           XMVectorGetY(FXMVECTOR V);
2347 FLOAT           XMVectorGetZ(FXMVECTOR V);
2348 FLOAT           XMVectorGetW(FXMVECTOR V);
2349
2350 VOID            XMVectorGetByIndexPtr(_Out_ FLOAT *f, FXMVECTOR V, UINT i);
2351 VOID            XMVectorGetXPtr(_Out_ FLOAT *x, FXMVECTOR V);
2352 VOID            XMVectorGetYPtr(_Out_ FLOAT *y, FXMVECTOR V);
2353 VOID            XMVectorGetZPtr(_Out_ FLOAT *z, FXMVECTOR V);
2354 VOID            XMVectorGetWPtr(_Out_ FLOAT *w, FXMVECTOR V);
2355
2356 UINT            XMVectorGetIntByIndex(FXMVECTOR V,UINT i);
2357 UINT            XMVectorGetIntX(FXMVECTOR V);
2358 UINT            XMVectorGetIntY(FXMVECTOR V);
2359 UINT            XMVectorGetIntZ(FXMVECTOR V);
2360 UINT            XMVectorGetIntW(FXMVECTOR V);
2361
2362 VOID            XMVectorGetIntByIndexPtr(_Out_ UINT *x,FXMVECTOR V, UINT i);
2363 VOID            XMVectorGetIntXPtr(_Out_ UINT *x, FXMVECTOR V);
2364 VOID            XMVectorGetIntYPtr(_Out_ UINT *y, FXMVECTOR V);
2365 VOID            XMVectorGetIntZPtr(_Out_ UINT *z, FXMVECTOR V);
2366 VOID            XMVectorGetIntWPtr(_Out_ UINT *w, FXMVECTOR V);
2367
2368 XMVECTOR        XMVectorSetByIndex(FXMVECTOR V,FLOAT f,UINT i);
2369 XMVECTOR        XMVectorSetX(FXMVECTOR V, FLOAT x);
2370 XMVECTOR        XMVectorSetY(FXMVECTOR V, FLOAT y);
2371 XMVECTOR        XMVectorSetZ(FXMVECTOR V, FLOAT z);
2372 XMVECTOR        XMVectorSetW(FXMVECTOR V, FLOAT w);
2373
2374 XMVECTOR        XMVectorSetByIndexPtr(FXMVECTOR V, _In_ CONST FLOAT *f, UINT i);
2375 XMVECTOR        XMVectorSetXPtr(FXMVECTOR V, _In_ CONST FLOAT *x);
2376 XMVECTOR        XMVectorSetYPtr(FXMVECTOR V, _In_ CONST FLOAT *y);
2377 XMVECTOR        XMVectorSetZPtr(FXMVECTOR V, _In_ CONST FLOAT *z);
2378 XMVECTOR        XMVectorSetWPtr(FXMVECTOR V, _In_ CONST FLOAT *w);
2379
2380 XMVECTOR        XMVectorSetIntByIndex(FXMVECTOR V, UINT x,UINT i);
2381 XMVECTOR        XMVectorSetIntX(FXMVECTOR V, UINT x);
2382 XMVECTOR        XMVectorSetIntY(FXMVECTOR V, UINT y);
2383 XMVECTOR        XMVectorSetIntZ(FXMVECTOR V, UINT z);
2384 XMVECTOR        XMVectorSetIntW(FXMVECTOR V, UINT w);
2385
2386 XMVECTOR        XMVectorSetIntByIndexPtr(FXMVECTOR V, _In_ CONST UINT *x, UINT i);
2387 XMVECTOR        XMVectorSetIntXPtr(FXMVECTOR V, _In_ CONST UINT *x);
2388 XMVECTOR        XMVectorSetIntYPtr(FXMVECTOR V, _In_ CONST UINT *y);
2389 XMVECTOR        XMVectorSetIntZPtr(FXMVECTOR V, _In_ CONST UINT *z);
2390 XMVECTOR        XMVectorSetIntWPtr(FXMVECTOR V, _In_ CONST UINT *w);
2391
2392 XMVECTOR        XMVectorPermuteControl(UINT ElementIndex0, UINT ElementIndex1, UINT ElementIndex2, UINT ElementIndex3);
2393 XMVECTOR        XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Control);
2394 XMVECTOR        XMVectorSelectControl(UINT VectorIndex0, UINT VectorIndex1, UINT VectorIndex2, UINT VectorIndex3);
2395 XMVECTOR        XMVectorSelect(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Control);
2396 XMVECTOR        XMVectorMergeXY(FXMVECTOR V1, FXMVECTOR V2);
2397 XMVECTOR        XMVectorMergeZW(FXMVECTOR V1, FXMVECTOR V2);
2398
2399 #if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_)
2400 XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2, UINT Elements);
2401 XMVECTOR XMVectorRotateLeft(FXMVECTOR V, UINT Elements);
2402 XMVECTOR XMVectorRotateRight(FXMVECTOR V, UINT Elements);
2403 XMVECTOR XMVectorSwizzle(FXMVECTOR V, UINT E0, UINT E1, UINT E2, UINT E3);
2404 XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateElements,
2405                         UINT Select0, UINT Select1, UINT Select2, UINT Select3);
2406
2407 // VMX128 versions defined below as macros
2408 #endif
2409
2410 XMVECTOR        XMVectorEqual(FXMVECTOR V1, FXMVECTOR V2);
2411 XMVECTOR        XMVectorEqualR(_Out_ UINT* pCR, FXMVECTOR V1, FXMVECTOR V2);
2412 XMVECTOR        XMVectorEqualInt(FXMVECTOR V1, FXMVECTOR V2);
2413 XMVECTOR        XMVectorEqualIntR(_Out_ UINT* pCR, FXMVECTOR V, FXMVECTOR V2);
2414 XMVECTOR        XMVectorNearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
2415 XMVECTOR        XMVectorNotEqual(FXMVECTOR V1, FXMVECTOR V2);
2416 XMVECTOR        XMVectorNotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
2417 XMVECTOR        XMVectorGreater(FXMVECTOR V1, FXMVECTOR V2);
2418 XMVECTOR        XMVectorGreaterR(_Out_ UINT* pCR, FXMVECTOR V1, FXMVECTOR V2);
2419 XMVECTOR        XMVectorGreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2420 XMVECTOR        XMVectorGreaterOrEqualR(_Out_ UINT* pCR, FXMVECTOR V1, FXMVECTOR V2);
2421 XMVECTOR        XMVectorLess(FXMVECTOR V1, FXMVECTOR V2);
2422 XMVECTOR        XMVectorLessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2423 XMVECTOR        XMVectorInBounds(FXMVECTOR V, FXMVECTOR Bounds);
2424 XMVECTOR        XMVectorInBoundsR(_Out_ UINT* pCR, FXMVECTOR V, FXMVECTOR Bounds);
2425
2426 XMVECTOR        XMVectorIsNaN(FXMVECTOR V);
2427 XMVECTOR        XMVectorIsInfinite(FXMVECTOR V);
2428
2429 XMVECTOR        XMVectorMin(FXMVECTOR V1,FXMVECTOR V2);
2430 XMVECTOR        XMVectorMax(FXMVECTOR V1, FXMVECTOR V2);
2431 XMVECTOR        XMVectorRound(FXMVECTOR V);
2432 XMVECTOR        XMVectorTruncate(FXMVECTOR V);
2433 XMVECTOR        XMVectorFloor(FXMVECTOR V);
2434 XMVECTOR        XMVectorCeiling(FXMVECTOR V);
2435 XMVECTOR        XMVectorClamp(FXMVECTOR V, FXMVECTOR Min, FXMVECTOR Max);
2436 XMVECTOR        XMVectorSaturate(FXMVECTOR V);
2437
2438 XMVECTOR        XMVectorAndInt(FXMVECTOR V1, FXMVECTOR V2);
2439 XMVECTOR        XMVectorAndCInt(FXMVECTOR V1, FXMVECTOR V2);
2440 XMVECTOR        XMVectorOrInt(FXMVECTOR V1, FXMVECTOR V2);
2441 XMVECTOR        XMVectorNorInt(FXMVECTOR V1, FXMVECTOR V2);
2442 XMVECTOR        XMVectorXorInt(FXMVECTOR V1, FXMVECTOR V2);
2443
2444 XMVECTOR        XMVectorNegate(FXMVECTOR V);
2445 XMVECTOR        XMVectorAdd(FXMVECTOR V1, FXMVECTOR V2);
2446 XMVECTOR        XMVectorAddAngles(FXMVECTOR V1, FXMVECTOR V2);
2447 XMVECTOR        XMVectorSubtract(FXMVECTOR V1, FXMVECTOR V2);
2448 XMVECTOR        XMVectorSubtractAngles(FXMVECTOR V1, FXMVECTOR V2);
2449 XMVECTOR        XMVectorMultiply(FXMVECTOR V1, FXMVECTOR V2);
2450 XMVECTOR        XMVectorMultiplyAdd(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3);
2451 XMVECTOR        XMVectorDivide(FXMVECTOR V1, FXMVECTOR V2);
2452 XMVECTOR        XMVectorNegativeMultiplySubtract(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3);
2453 XMVECTOR        XMVectorScale(FXMVECTOR V, FLOAT ScaleFactor);
2454 XMVECTOR        XMVectorReciprocalEst(FXMVECTOR V);
2455 XMVECTOR        XMVectorReciprocal(FXMVECTOR V);
2456 XMVECTOR        XMVectorSqrtEst(FXMVECTOR V);
2457 XMVECTOR        XMVectorSqrt(FXMVECTOR V);
2458 XMVECTOR        XMVectorReciprocalSqrtEst(FXMVECTOR V);
2459 XMVECTOR        XMVectorReciprocalSqrt(FXMVECTOR V);
2460 XMVECTOR        XMVectorExpEst(FXMVECTOR V);
2461 XMVECTOR        XMVectorExp(FXMVECTOR V);
2462 XMVECTOR        XMVectorLogEst(FXMVECTOR V);
2463 XMVECTOR        XMVectorLog(FXMVECTOR V);
2464 XMVECTOR        XMVectorPowEst(FXMVECTOR V1, FXMVECTOR V2);
2465 XMVECTOR        XMVectorPow(FXMVECTOR V1, FXMVECTOR V2);
2466 XMVECTOR        XMVectorAbs(FXMVECTOR V);
2467 XMVECTOR        XMVectorMod(FXMVECTOR V1, FXMVECTOR V2);
2468 XMVECTOR        XMVectorModAngles(FXMVECTOR Angles);
2469 XMVECTOR        XMVectorSin(FXMVECTOR V);
2470 XMVECTOR        XMVectorSinEst(FXMVECTOR V);
2471 XMVECTOR        XMVectorCos(FXMVECTOR V);
2472 XMVECTOR        XMVectorCosEst(FXMVECTOR V);
2473 VOID            XMVectorSinCos(_Out_ XMVECTOR* pSin, _Out_ XMVECTOR* pCos, FXMVECTOR V);
2474 VOID            XMVectorSinCosEst(_Out_ XMVECTOR* pSin, _Out_ XMVECTOR* pCos, FXMVECTOR V);
2475 XMVECTOR        XMVectorTan(FXMVECTOR V);
2476 XMVECTOR        XMVectorTanEst(FXMVECTOR V);
2477 XMVECTOR        XMVectorSinH(FXMVECTOR V);
2478 XMVECTOR        XMVectorSinHEst(FXMVECTOR V);
2479 XMVECTOR        XMVectorCosH(FXMVECTOR V);
2480 XMVECTOR        XMVectorCosHEst(FXMVECTOR V);
2481 XMVECTOR        XMVectorTanH(FXMVECTOR V);
2482 XMVECTOR        XMVectorTanHEst(FXMVECTOR V);
2483 XMVECTOR        XMVectorASin(FXMVECTOR V);
2484 XMVECTOR        XMVectorASinEst(FXMVECTOR V);
2485 XMVECTOR        XMVectorACos(FXMVECTOR V);
2486 XMVECTOR        XMVectorACosEst(FXMVECTOR V);
2487 XMVECTOR        XMVectorATan(FXMVECTOR V);
2488 XMVECTOR        XMVectorATanEst(FXMVECTOR V);
2489 XMVECTOR        XMVectorATan2(FXMVECTOR Y, FXMVECTOR X);
2490 XMVECTOR        XMVectorATan2Est(FXMVECTOR Y, FXMVECTOR X);
2491 XMVECTOR        XMVectorLerp(FXMVECTOR V0, FXMVECTOR V1, FLOAT t);
2492 XMVECTOR        XMVectorLerpV(FXMVECTOR V0, FXMVECTOR V1, FXMVECTOR T);
2493 XMVECTOR        XMVectorHermite(FXMVECTOR Position0, FXMVECTOR Tangent0, FXMVECTOR Position1, CXMVECTOR Tangent1, FLOAT t);
2494 XMVECTOR        XMVectorHermiteV(FXMVECTOR Position0, FXMVECTOR Tangent0, FXMVECTOR Position1, CXMVECTOR Tangent1, CXMVECTOR T);
2495 XMVECTOR        XMVectorCatmullRom(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR Position3, FLOAT t);
2496 XMVECTOR        XMVectorCatmullRomV(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR Position3, CXMVECTOR T);
2497 XMVECTOR        XMVectorBaryCentric(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, FLOAT f, FLOAT g);
2498 XMVECTOR        XMVectorBaryCentricV(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR F, CXMVECTOR G);
2499
2500 /****************************************************************************
2501  *
2502  * 2D vector operations
2503  *
2504  ****************************************************************************/
2505
2506
2507 BOOL            XMVector2Equal(FXMVECTOR V1, FXMVECTOR V2);
2508 UINT            XMVector2EqualR(FXMVECTOR V1, FXMVECTOR V2);
2509 BOOL            XMVector2EqualInt(FXMVECTOR V1, FXMVECTOR V2);
2510 UINT            XMVector2EqualIntR(FXMVECTOR V1, FXMVECTOR V2);
2511 BOOL            XMVector2NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
2512 BOOL            XMVector2NotEqual(FXMVECTOR V1, FXMVECTOR V2);
2513 BOOL            XMVector2NotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
2514 BOOL            XMVector2Greater(FXMVECTOR V1, FXMVECTOR V2);
2515 UINT            XMVector2GreaterR(FXMVECTOR V1, FXMVECTOR V2);
2516 BOOL            XMVector2GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2517 UINT            XMVector2GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
2518 BOOL            XMVector2Less(FXMVECTOR V1, FXMVECTOR V2);
2519 BOOL            XMVector2LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2520 BOOL            XMVector2InBounds(FXMVECTOR V, FXMVECTOR Bounds);
2521 UINT            XMVector2InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
2522
2523 BOOL            XMVector2IsNaN(FXMVECTOR V);
2524 BOOL            XMVector2IsInfinite(FXMVECTOR V);
2525
2526 XMVECTOR        XMVector2Dot(FXMVECTOR V1, FXMVECTOR V2);
2527 XMVECTOR        XMVector2Cross(FXMVECTOR V1, FXMVECTOR V2);
2528 XMVECTOR        XMVector2LengthSq(FXMVECTOR V);
2529 XMVECTOR        XMVector2ReciprocalLengthEst(FXMVECTOR V);
2530 XMVECTOR        XMVector2ReciprocalLength(FXMVECTOR V);
2531 XMVECTOR        XMVector2LengthEst(FXMVECTOR V);
2532 XMVECTOR        XMVector2Length(FXMVECTOR V);
2533 XMVECTOR        XMVector2NormalizeEst(FXMVECTOR V);
2534 XMVECTOR        XMVector2Normalize(FXMVECTOR V);
2535 XMVECTOR        XMVector2ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax);
2536 XMVECTOR        XMVector2ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax);
2537 XMVECTOR        XMVector2Reflect(FXMVECTOR Incident, FXMVECTOR Normal);
2538 XMVECTOR        XMVector2Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex);
2539 XMVECTOR        XMVector2RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex);
2540 XMVECTOR        XMVector2Orthogonal(FXMVECTOR V);
2541 XMVECTOR        XMVector2AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2);
2542 XMVECTOR        XMVector2AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2);
2543 XMVECTOR        XMVector2AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2);
2544 XMVECTOR        XMVector2LinePointDistance(FXMVECTOR LinePoint1, FXMVECTOR LinePoint2, FXMVECTOR Point);
2545 XMVECTOR        XMVector2IntersectLine(FXMVECTOR Line1Point1, FXMVECTOR Line1Point2, FXMVECTOR Line2Point1, CXMVECTOR Line2Point2);
2546 XMVECTOR        XMVector2Transform(FXMVECTOR V, CXMMATRIX M);
2547 XMFLOAT4*       XMVector2TransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
2548                                          _In_ size_t OutputStride,
2549                                          _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
2550                                          _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2551 XMFLOAT4*       XMVector2TransformStreamNC(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
2552                                            _In_ size_t OutputStride,
2553                                            _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
2554                                            _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2555 XMVECTOR        XMVector2TransformCoord(FXMVECTOR V, CXMMATRIX M);
2556 XMFLOAT2*       XMVector2TransformCoordStream(_Out_bytecap_x_(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream,
2557                                               _In_ size_t OutputStride,
2558                                               _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
2559                                               _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2560 XMVECTOR        XMVector2TransformNormal(FXMVECTOR V, CXMMATRIX M);
2561 XMFLOAT2*       XMVector2TransformNormalStream(_Out_bytecap_x_(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream,
2562                                                _In_ size_t OutputStride,
2563                                                _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
2564                                                _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2565
2566 /****************************************************************************
2567  *
2568  * 3D vector operations
2569  *
2570  ****************************************************************************/
2571
2572
2573 BOOL            XMVector3Equal(FXMVECTOR V1, FXMVECTOR V2);
2574 UINT            XMVector3EqualR(FXMVECTOR V1, FXMVECTOR V2);
2575 BOOL            XMVector3EqualInt(FXMVECTOR V1, FXMVECTOR V2);
2576 UINT            XMVector3EqualIntR(FXMVECTOR V1, FXMVECTOR V2);
2577 BOOL            XMVector3NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
2578 BOOL            XMVector3NotEqual(FXMVECTOR V1, FXMVECTOR V2);
2579 BOOL            XMVector3NotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
2580 BOOL            XMVector3Greater(FXMVECTOR V1, FXMVECTOR V2);
2581 UINT            XMVector3GreaterR(FXMVECTOR V1, FXMVECTOR V2);
2582 BOOL            XMVector3GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2583 UINT            XMVector3GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
2584 BOOL            XMVector3Less(FXMVECTOR V1, FXMVECTOR V2);
2585 BOOL            XMVector3LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2586 BOOL            XMVector3InBounds(FXMVECTOR V, FXMVECTOR Bounds);
2587 UINT            XMVector3InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
2588
2589 BOOL            XMVector3IsNaN(FXMVECTOR V);
2590 BOOL            XMVector3IsInfinite(FXMVECTOR V);
2591
2592 XMVECTOR        XMVector3Dot(FXMVECTOR V1, FXMVECTOR V2);
2593 XMVECTOR        XMVector3Cross(FXMVECTOR V1, FXMVECTOR V2);
2594 XMVECTOR        XMVector3LengthSq(FXMVECTOR V);
2595 XMVECTOR        XMVector3ReciprocalLengthEst(FXMVECTOR V);
2596 XMVECTOR        XMVector3ReciprocalLength(FXMVECTOR V);
2597 XMVECTOR        XMVector3LengthEst(FXMVECTOR V);
2598 XMVECTOR        XMVector3Length(FXMVECTOR V);
2599 XMVECTOR        XMVector3NormalizeEst(FXMVECTOR V);
2600 XMVECTOR        XMVector3Normalize(FXMVECTOR V);
2601 XMVECTOR        XMVector3ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax);
2602 XMVECTOR        XMVector3ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax);
2603 XMVECTOR        XMVector3Reflect(FXMVECTOR Incident, FXMVECTOR Normal);
2604 XMVECTOR        XMVector3Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex);
2605 XMVECTOR        XMVector3RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex);
2606 XMVECTOR        XMVector3Orthogonal(FXMVECTOR V);
2607 XMVECTOR        XMVector3AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2);
2608 XMVECTOR        XMVector3AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2);
2609 XMVECTOR        XMVector3AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2);
2610 XMVECTOR        XMVector3LinePointDistance(FXMVECTOR LinePoint1, FXMVECTOR LinePoint2, FXMVECTOR Point);
2611 VOID            XMVector3ComponentsFromNormal(_Out_ XMVECTOR* pParallel, _Out_ XMVECTOR* pPerpendicular, FXMVECTOR V, FXMVECTOR Normal);
2612 XMVECTOR        XMVector3Rotate(FXMVECTOR V, FXMVECTOR RotationQuaternion);
2613 XMVECTOR        XMVector3InverseRotate(FXMVECTOR V, FXMVECTOR RotationQuaternion);
2614 XMVECTOR        XMVector3Transform(FXMVECTOR V, CXMMATRIX M);
2615 XMFLOAT4*       XMVector3TransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
2616                                          _In_ size_t OutputStride,
2617                                          _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
2618                                          _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2619 XMFLOAT4*       XMVector3TransformStreamNC(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
2620                                            _In_ size_t OutputStride,
2621                                            _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
2622                                            _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2623 XMVECTOR        XMVector3TransformCoord(FXMVECTOR V, CXMMATRIX M);
2624 XMFLOAT3*       XMVector3TransformCoordStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
2625                                               _In_ size_t OutputStride,
2626                                               _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
2627                                               _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2628 XMVECTOR        XMVector3TransformNormal(FXMVECTOR V, CXMMATRIX M);
2629 XMFLOAT3*       XMVector3TransformNormalStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
2630                                                _In_ size_t OutputStride,
2631                                                _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
2632                                                _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2633 XMVECTOR        XMVector3Project(FXMVECTOR V, FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, 
2634                     CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
2635 XMFLOAT3*       XMVector3ProjectStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
2636                                        _In_ size_t OutputStride,
2637                                        _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
2638                                        _In_ size_t InputStride, _In_ size_t VectorCount, 
2639                     FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, 
2640                     CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
2641 XMVECTOR        XMVector3Unproject(FXMVECTOR V, FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, 
2642                     CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
2643 XMFLOAT3*       XMVector3UnprojectStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
2644                                          _In_ size_t OutputStride,
2645                                          _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
2646                                          _In_ size_t InputStride, _In_ size_t VectorCount, 
2647                     FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, 
2648                     CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
2649
2650 /****************************************************************************
2651  *
2652  * 4D vector operations
2653  *
2654  ****************************************************************************/
2655
2656 BOOL            XMVector4Equal(FXMVECTOR V1, FXMVECTOR V2);
2657 UINT            XMVector4EqualR(FXMVECTOR V1, FXMVECTOR V2);
2658 BOOL            XMVector4EqualInt(FXMVECTOR V1, FXMVECTOR V2);
2659 UINT            XMVector4EqualIntR(FXMVECTOR V1, FXMVECTOR V2);
2660 BOOL            XMVector4NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
2661 BOOL            XMVector4NotEqual(FXMVECTOR V1, FXMVECTOR V2);
2662 BOOL            XMVector4NotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
2663 BOOL            XMVector4Greater(FXMVECTOR V1, FXMVECTOR V2);
2664 UINT            XMVector4GreaterR(FXMVECTOR V1, FXMVECTOR V2);
2665 BOOL            XMVector4GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2666 UINT            XMVector4GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
2667 BOOL            XMVector4Less(FXMVECTOR V1, FXMVECTOR V2);
2668 BOOL            XMVector4LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
2669 BOOL            XMVector4InBounds(FXMVECTOR V, FXMVECTOR Bounds);
2670 UINT            XMVector4InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
2671
2672 BOOL            XMVector4IsNaN(FXMVECTOR V);
2673 BOOL            XMVector4IsInfinite(FXMVECTOR V);
2674
2675 XMVECTOR        XMVector4Dot(FXMVECTOR V1, FXMVECTOR V2);
2676 XMVECTOR        XMVector4Cross(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3);
2677 XMVECTOR        XMVector4LengthSq(FXMVECTOR V);
2678 XMVECTOR        XMVector4ReciprocalLengthEst(FXMVECTOR V);
2679 XMVECTOR        XMVector4ReciprocalLength(FXMVECTOR V);
2680 XMVECTOR        XMVector4LengthEst(FXMVECTOR V);
2681 XMVECTOR        XMVector4Length(FXMVECTOR V);
2682 XMVECTOR        XMVector4NormalizeEst(FXMVECTOR V);
2683 XMVECTOR        XMVector4Normalize(FXMVECTOR V);
2684 XMVECTOR        XMVector4ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax);
2685 XMVECTOR        XMVector4ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax);
2686 XMVECTOR        XMVector4Reflect(FXMVECTOR Incident, FXMVECTOR Normal);
2687 XMVECTOR        XMVector4Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex);
2688 XMVECTOR        XMVector4RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex);
2689 XMVECTOR        XMVector4Orthogonal(FXMVECTOR V);
2690 XMVECTOR        XMVector4AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2);
2691 XMVECTOR        XMVector4AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2);
2692 XMVECTOR        XMVector4AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2);
2693 XMVECTOR        XMVector4Transform(FXMVECTOR V, CXMMATRIX M);
2694 XMFLOAT4*       XMVector4TransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
2695                                          _In_ size_t OutputStride,
2696                                          _In_bytecount_x_(sizeof(XMFLOAT4)+InputStride*(VectorCount-1)) CONST XMFLOAT4* pInputStream,
2697                                          _In_ size_t InputStride, _In_ size_t VectorCount, CXMMATRIX M);
2698
2699 /****************************************************************************
2700  *
2701  * Matrix operations
2702  *
2703  ****************************************************************************/
2704
2705 BOOL            XMMatrixIsNaN(CXMMATRIX M);
2706 BOOL            XMMatrixIsInfinite(CXMMATRIX M);
2707 BOOL            XMMatrixIsIdentity(CXMMATRIX M);
2708
2709 XMMATRIX        XMMatrixMultiply(CXMMATRIX M1, CXMMATRIX M2);
2710 XMMATRIX        XMMatrixMultiplyTranspose(CXMMATRIX M1, CXMMATRIX M2);
2711 XMMATRIX        XMMatrixTranspose(CXMMATRIX M);
2712 XMMATRIX        XMMatrixInverse(_Out_opt_ XMVECTOR* pDeterminant, CXMMATRIX M);
2713 XMVECTOR        XMMatrixDeterminant(CXMMATRIX M);
2714 BOOL            XMMatrixDecompose(_Out_ XMVECTOR *outScale, _Out_ XMVECTOR *outRotQuat, _Out_ XMVECTOR *outTrans, CXMMATRIX M);
2715
2716 XMMATRIX        XMMatrixIdentity();
2717 XMMATRIX        XMMatrixSet(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
2718                          FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
2719                          FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
2720                          FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33);
2721 XMMATRIX        XMMatrixTranslation(FLOAT OffsetX, FLOAT OffsetY, FLOAT OffsetZ);
2722 XMMATRIX        XMMatrixTranslationFromVector(FXMVECTOR Offset);
2723 XMMATRIX        XMMatrixScaling(FLOAT ScaleX, FLOAT ScaleY, FLOAT ScaleZ);
2724 XMMATRIX        XMMatrixScalingFromVector(FXMVECTOR Scale);
2725 XMMATRIX        XMMatrixRotationX(FLOAT Angle);
2726 XMMATRIX        XMMatrixRotationY(FLOAT Angle);
2727 XMMATRIX        XMMatrixRotationZ(FLOAT Angle);
2728 XMMATRIX        XMMatrixRotationRollPitchYaw(FLOAT Pitch, FLOAT Yaw, FLOAT Roll);
2729 XMMATRIX        XMMatrixRotationRollPitchYawFromVector(FXMVECTOR Angles);
2730 XMMATRIX        XMMatrixRotationNormal(FXMVECTOR NormalAxis, FLOAT Angle);
2731 XMMATRIX        XMMatrixRotationAxis(FXMVECTOR Axis, FLOAT Angle);
2732 XMMATRIX        XMMatrixRotationQuaternion(FXMVECTOR Quaternion);
2733 XMMATRIX        XMMatrixTransformation2D(FXMVECTOR ScalingOrigin, FLOAT ScalingOrientation, FXMVECTOR Scaling, 
2734                     FXMVECTOR RotationOrigin, FLOAT Rotation, CXMVECTOR Translation);
2735 XMMATRIX        XMMatrixTransformation(FXMVECTOR ScalingOrigin, FXMVECTOR ScalingOrientationQuaternion, FXMVECTOR Scaling, 
2736                     CXMVECTOR RotationOrigin, CXMVECTOR RotationQuaternion, CXMVECTOR Translation);
2737 XMMATRIX        XMMatrixAffineTransformation2D(FXMVECTOR Scaling, FXMVECTOR RotationOrigin, FLOAT Rotation, FXMVECTOR Translation);
2738 XMMATRIX        XMMatrixAffineTransformation(FXMVECTOR Scaling, FXMVECTOR RotationOrigin, FXMVECTOR RotationQuaternion, CXMVECTOR Translation);
2739 XMMATRIX        XMMatrixReflect(FXMVECTOR ReflectionPlane);
2740 XMMATRIX        XMMatrixShadow(FXMVECTOR ShadowPlane, FXMVECTOR LightPosition);
2741
2742 XMMATRIX        XMMatrixLookAtLH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection);
2743 XMMATRIX        XMMatrixLookAtRH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection);
2744 XMMATRIX        XMMatrixLookToLH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection);
2745 XMMATRIX        XMMatrixLookToRH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection);
2746 XMMATRIX        XMMatrixPerspectiveLH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
2747 XMMATRIX        XMMatrixPerspectiveRH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
2748 XMMATRIX        XMMatrixPerspectiveFovLH(FLOAT FovAngleY, FLOAT AspectHByW, FLOAT NearZ, FLOAT FarZ);
2749 XMMATRIX        XMMatrixPerspectiveFovRH(FLOAT FovAngleY, FLOAT AspectHByW, FLOAT NearZ, FLOAT FarZ);
2750 XMMATRIX        XMMatrixPerspectiveOffCenterLH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
2751 XMMATRIX        XMMatrixPerspectiveOffCenterRH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
2752 XMMATRIX        XMMatrixOrthographicLH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
2753 XMMATRIX        XMMatrixOrthographicRH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
2754 XMMATRIX        XMMatrixOrthographicOffCenterLH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
2755 XMMATRIX        XMMatrixOrthographicOffCenterRH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
2756
2757
2758 /****************************************************************************
2759  *
2760  * Quaternion operations
2761  *
2762  ****************************************************************************/
2763
2764 BOOL            XMQuaternionEqual(FXMVECTOR Q1, FXMVECTOR Q2);
2765 BOOL            XMQuaternionNotEqual(FXMVECTOR Q1, FXMVECTOR Q2);
2766
2767 BOOL            XMQuaternionIsNaN(FXMVECTOR Q);
2768 BOOL            XMQuaternionIsInfinite(FXMVECTOR Q);
2769 BOOL            XMQuaternionIsIdentity(FXMVECTOR Q);
2770
2771 XMVECTOR        XMQuaternionDot(FXMVECTOR Q1, FXMVECTOR Q2);
2772 XMVECTOR        XMQuaternionMultiply(FXMVECTOR Q1, FXMVECTOR Q2);
2773 XMVECTOR        XMQuaternionLengthSq(FXMVECTOR Q);
2774 XMVECTOR        XMQuaternionReciprocalLength(FXMVECTOR Q);
2775 XMVECTOR        XMQuaternionLength(FXMVECTOR Q);
2776 XMVECTOR        XMQuaternionNormalizeEst(FXMVECTOR Q);
2777 XMVECTOR        XMQuaternionNormalize(FXMVECTOR Q);
2778 XMVECTOR        XMQuaternionConjugate(FXMVECTOR Q);
2779 XMVECTOR        XMQuaternionInverse(FXMVECTOR Q);
2780 XMVECTOR        XMQuaternionLn(FXMVECTOR Q);
2781 XMVECTOR        XMQuaternionExp(FXMVECTOR Q);
2782 XMVECTOR        XMQuaternionSlerp(FXMVECTOR Q0, FXMVECTOR Q1, FLOAT t);
2783 XMVECTOR        XMQuaternionSlerpV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR T);
2784 XMVECTOR        XMQuaternionSquad(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3, FLOAT t);
2785 XMVECTOR        XMQuaternionSquadV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3, CXMVECTOR T);
2786 VOID            XMQuaternionSquadSetup(_Out_ XMVECTOR* pA, _Out_ XMVECTOR* pB, _Out_ XMVECTOR* pC, FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3);
2787 XMVECTOR        XMQuaternionBaryCentric(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, FLOAT f, FLOAT g);
2788 XMVECTOR        XMQuaternionBaryCentricV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR F, CXMVECTOR G);
2789
2790 XMVECTOR        XMQuaternionIdentity();
2791 XMVECTOR        XMQuaternionRotationRollPitchYaw(FLOAT Pitch, FLOAT Yaw, FLOAT Roll);
2792 XMVECTOR        XMQuaternionRotationRollPitchYawFromVector(FXMVECTOR Angles);
2793 XMVECTOR        XMQuaternionRotationNormal(FXMVECTOR NormalAxis, FLOAT Angle);
2794 XMVECTOR        XMQuaternionRotationAxis(FXMVECTOR Axis, FLOAT Angle);
2795 XMVECTOR        XMQuaternionRotationMatrix(CXMMATRIX M);
2796
2797 VOID            XMQuaternionToAxisAngle(_Out_ XMVECTOR* pAxis, _Out_ FLOAT* pAngle, FXMVECTOR Q);
2798
2799 /****************************************************************************
2800  *
2801  * Plane operations
2802  *
2803  ****************************************************************************/
2804
2805 BOOL            XMPlaneEqual(FXMVECTOR P1, FXMVECTOR P2);
2806 BOOL            XMPlaneNearEqual(FXMVECTOR P1, FXMVECTOR P2, FXMVECTOR Epsilon);
2807 BOOL            XMPlaneNotEqual(FXMVECTOR P1, FXMVECTOR P2);
2808
2809 BOOL            XMPlaneIsNaN(FXMVECTOR P);
2810 BOOL            XMPlaneIsInfinite(FXMVECTOR P);
2811
2812 XMVECTOR        XMPlaneDot(FXMVECTOR P, FXMVECTOR V);
2813 XMVECTOR        XMPlaneDotCoord(FXMVECTOR P, FXMVECTOR V);
2814 XMVECTOR        XMPlaneDotNormal(FXMVECTOR P, FXMVECTOR V);
2815 XMVECTOR        XMPlaneNormalizeEst(FXMVECTOR P);
2816 XMVECTOR        XMPlaneNormalize(FXMVECTOR P);
2817 XMVECTOR        XMPlaneIntersectLine(FXMVECTOR P, FXMVECTOR LinePoint1, FXMVECTOR LinePoint2);
2818 VOID            XMPlaneIntersectPlane(_Out_ XMVECTOR* pLinePoint1, _Out_ XMVECTOR* pLinePoint2, FXMVECTOR P1, FXMVECTOR P2);
2819 XMVECTOR        XMPlaneTransform(FXMVECTOR P, CXMMATRIX M);
2820 XMFLOAT4*       XMPlaneTransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(PlaneCount-1)) XMFLOAT4* pOutputStream,
2821                                        _In_ size_t OutputStride,
2822                                        _In_bytecount_x_(sizeof(XMFLOAT4)+InputStride*(PlaneCount-1)) CONST XMFLOAT4* pInputStream,
2823                                        _In_ size_t InputStride, _In_ size_t PlaneCount, CXMMATRIX M);
2824
2825 XMVECTOR        XMPlaneFromPointNormal(FXMVECTOR Point, FXMVECTOR Normal);
2826 XMVECTOR        XMPlaneFromPoints(FXMVECTOR Point1, FXMVECTOR Point2, FXMVECTOR Point3);
2827
2828 /****************************************************************************
2829  *
2830  * Color operations
2831  *
2832  ****************************************************************************/
2833
2834 BOOL            XMColorEqual(FXMVECTOR C1, FXMVECTOR C2);
2835 BOOL            XMColorNotEqual(FXMVECTOR C1, FXMVECTOR C2);
2836 BOOL            XMColorGreater(FXMVECTOR C1, FXMVECTOR C2);
2837 BOOL            XMColorGreaterOrEqual(FXMVECTOR C1, FXMVECTOR C2);
2838 BOOL            XMColorLess(FXMVECTOR C1, FXMVECTOR C2);
2839 BOOL            XMColorLessOrEqual(FXMVECTOR C1, FXMVECTOR C2);
2840
2841 BOOL            XMColorIsNaN(FXMVECTOR C);
2842 BOOL            XMColorIsInfinite(FXMVECTOR C);
2843
2844 XMVECTOR        XMColorNegative(FXMVECTOR C);
2845 XMVECTOR        XMColorModulate(FXMVECTOR C1, FXMVECTOR C2);
2846 XMVECTOR        XMColorAdjustSaturation(FXMVECTOR C, FLOAT Saturation);
2847 XMVECTOR        XMColorAdjustContrast(FXMVECTOR C, FLOAT Contrast);
2848
2849 /****************************************************************************
2850  *
2851  * Miscellaneous operations
2852  *
2853  ****************************************************************************/
2854
2855 BOOL            XMVerifyCPUSupport();
2856
2857 VOID            XMAssert(_In_z_ CONST CHAR* pExpression, _In_z_ CONST CHAR* pFileName, UINT LineNumber);
2858
2859 XMVECTOR        XMFresnelTerm(FXMVECTOR CosIncidentAngle, FXMVECTOR RefractionIndex);
2860
2861 BOOL            XMScalarNearEqual(FLOAT S1, FLOAT S2, FLOAT Epsilon);
2862 FLOAT           XMScalarModAngle(FLOAT Value);
2863 FLOAT           XMScalarSin(FLOAT Value);
2864 FLOAT           XMScalarCos(FLOAT Value);
2865 VOID            XMScalarSinCos(_Out_ FLOAT* pSin, _Out_ FLOAT* pCos, FLOAT Value);
2866 FLOAT           XMScalarASin(FLOAT Value);
2867 FLOAT           XMScalarACos(FLOAT Value);
2868 FLOAT           XMScalarSinEst(FLOAT Value);
2869 FLOAT           XMScalarCosEst(FLOAT Value);
2870 VOID            XMScalarSinCosEst(_Out_ FLOAT* pSin, _Out_ FLOAT* pCos, FLOAT Value);
2871 FLOAT           XMScalarASinEst(FLOAT Value);
2872 FLOAT           XMScalarACosEst(FLOAT Value);
2873
2874 /****************************************************************************
2875  *
2876  * Templates
2877  *
2878  ****************************************************************************/
2879
2880 #if defined(__cplusplus)
2881
2882 #if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
2883
2884 // PermuteHelper internal template (SSE only)
2885 namespace XNAMathInternal
2886 {
2887     // Slow path fallback for permutes that do not map to a single SSE shuffle opcode.
2888     template<UINT Shuffle, bool WhichX, bool WhichY, bool WhichZ, bool WhichW> struct PermuteHelper
2889     {
2890         static XMVECTOR Permute(FXMVECTOR v1, FXMVECTOR v2)
2891         {
2892             static const XMVECTORU32 selectMask =
2893             {
2894                 WhichX ? 0xFFFFFFFF : 0,
2895                 WhichY ? 0xFFFFFFFF : 0,
2896                 WhichZ ? 0xFFFFFFFF : 0,
2897                 WhichW ? 0xFFFFFFFF : 0,
2898             };
2899
2900             XMVECTOR shuffled1 = _mm_shuffle_ps(v1, v1, Shuffle);
2901             XMVECTOR shuffled2 = _mm_shuffle_ps(v2, v2, Shuffle);
2902
2903             XMVECTOR masked1 = _mm_andnot_ps(selectMask, shuffled1);
2904             XMVECTOR masked2 = _mm_and_ps(selectMask, shuffled2);
2905
2906             return _mm_or_ps(masked1, masked2);
2907         }
2908     };
2909
2910     // Fast path for permutes that only read from the first vector.
2911     template<UINT Shuffle> struct PermuteHelper<Shuffle, false, false, false, false>
2912     {
2913         static XMVECTOR Permute(FXMVECTOR v1, FXMVECTOR v2) { (v2); return _mm_shuffle_ps(v1, v1, Shuffle); }
2914     };
2915
2916     // Fast path for permutes that only read from the second vector.
2917     template<UINT Shuffle> struct PermuteHelper<Shuffle, true, true, true, true>
2918     {
2919         static XMVECTOR Permute(FXMVECTOR v1, FXMVECTOR v2){ (v1); return _mm_shuffle_ps(v2, v2, Shuffle); }
2920     };
2921
2922     // Fast path for permutes that read XY from the first vector, ZW from the second.
2923     template<UINT Shuffle> struct PermuteHelper<Shuffle, false, false, true, true>
2924     {
2925         static XMVECTOR Permute(FXMVECTOR v1, FXMVECTOR v2) { return _mm_shuffle_ps(v1, v2, Shuffle); }
2926     };
2927
2928     // Fast path for permutes that read XY from the second vector, ZW from the first.
2929     template<UINT Shuffle> struct PermuteHelper<Shuffle, true, true, false, false>
2930     {
2931         static XMVECTOR Permute(FXMVECTOR v1, FXMVECTOR v2) { return _mm_shuffle_ps(v2, v1, Shuffle); }
2932     };
2933 };
2934
2935 #endif // _XM_SSE_INTRINSICS_ && !_XM_NO_INTRINSICS_
2936
2937 // General permute template
2938 template<UINT PermuteX, UINT PermuteY, UINT PermuteZ, UINT PermuteW>
2939     inline XMVECTOR XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2)
2940 {
2941 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
2942     static_assert(PermuteX <= 7, "PermuteX template parameter out of range");
2943     static_assert(PermuteY <= 7, "PermuteY template parameter out of range");
2944     static_assert(PermuteZ <= 7, "PermuteZ template parameter out of range");
2945     static_assert(PermuteW <= 7, "PermuteW template parameter out of range");
2946 #else
2947     XMASSERT(PermuteX <= 7);
2948     XMASSERT(PermuteY <= 7);
2949     XMASSERT(PermuteZ <= 7);
2950     XMASSERT(PermuteW <= 7);
2951 #endif
2952
2953 #if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
2954     const UINT Shuffle = _MM_SHUFFLE(PermuteW & 3, PermuteZ & 3, PermuteY & 3, PermuteX & 3);
2955
2956     const bool WhichX = PermuteX > 3;
2957     const bool WhichY = PermuteY > 3;
2958     const bool WhichZ = PermuteZ > 3;
2959     const bool WhichW = PermuteW > 3;
2960
2961     return XNAMathInternal::PermuteHelper<Shuffle, WhichX, WhichY, WhichZ, WhichW>::Permute(V1, V2);
2962 #else
2963
2964     XMVECTOR c = XMVectorPermuteControl( PermuteX, PermuteY, PermuteZ, PermuteW );
2965     return XMVectorPermute( V1, V2, c );
2966
2967 #endif
2968 }
2969
2970 // Special-case permute templates
2971 template<> inline XMVECTOR XMVectorPermute<0,1,2,3>(FXMVECTOR V1, FXMVECTOR V2) { (V2); return V1; }
2972 template<> inline XMVECTOR XMVectorPermute<4,5,6,7>(FXMVECTOR V1, FXMVECTOR V2) { (V1); return V2; }
2973
2974 //------------------------------------------------------------------------------
2975
2976 // General swizzle template
2977 template<UINT SwizzleX, UINT SwizzleY, UINT SwizzleZ, UINT SwizzleW>
2978     inline XMVECTOR XMVectorSwizzle(FXMVECTOR V)
2979 {
2980 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
2981     static_assert(SwizzleX <= 3, "SwizzleX template parameter out of range");
2982     static_assert(SwizzleY <= 3, "SwizzleY template parameter out of range");
2983     static_assert(SwizzleZ <= 3, "SwizzleZ template parameter out of range");
2984     static_assert(SwizzleW <= 3, "SwizzleW template parameter out of range");
2985 #else
2986     XMASSERT(SwizzleX <= 3);
2987     XMASSERT(SwizzleY <= 3);
2988     XMASSERT(SwizzleZ <= 3);
2989     XMASSERT(SwizzleW <= 3);
2990 #endif
2991
2992 #if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
2993     return _mm_shuffle_ps( V, V, _MM_SHUFFLE( SwizzleW, SwizzleZ, SwizzleY, SwizzleX ) );
2994 #elif defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
2995     return __vpermwi(V, ((SwizzleX & 3) << 6) | ((SwizzleY & 3) << 4) | ((SwizzleZ & 3) << 2) | (SwizzleW & 3) );
2996 #else
2997
2998     return XMVectorSwizzle( V, SwizzleX, SwizzleY, SwizzleZ, SwizzleW );
2999
3000 #endif
3001 }
3002
3003 // Specialized swizzles
3004 template<> inline XMVECTOR XMVectorSwizzle<0,1,2,3>(FXMVECTOR V) { return V; }
3005
3006 //------------------------------------------------------------------------------
3007
3008 template<UINT Elements>
3009     inline XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2)
3010 {
3011 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
3012     static_assert( Elements < 4, "Elements template parameter out of range" );
3013 #else
3014     XMASSERT( Elements < 4 );
3015 #endif
3016
3017 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
3018 #else
3019     return XMVectorPermute<Elements, (Elements + 1), (Elements + 2), (Elements + 3)>(V1, V2);
3020 #endif
3021 }
3022
3023 template<UINT Elements>
3024     inline XMVECTOR XMVectorRotateLeft(FXMVECTOR V)
3025 {
3026 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
3027     static_assert( Elements < 4, "Elements template parameter out of range" );
3028 #else
3029     XMASSERT( Elements < 4 );
3030 #endif
3031
3032 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
3033 #else
3034     return XMVectorSwizzle<Elements & 3, (Elements + 1) & 3, (Elements + 2) & 3, (Elements + 3) & 3>(V);
3035 #endif
3036 }
3037
3038 template<UINT Elements>
3039     inline XMVECTOR XMVectorRotateRight(FXMVECTOR V)
3040 {
3041 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
3042     static_assert( Elements < 4, "Elements template parameter out of range" );
3043 #else
3044     XMASSERT( Elements < 4 );
3045 #endif
3046
3047 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
3048 #else
3049     return XMVectorSwizzle<(4 - Elements) & 3, (5 - Elements) & 3, (6 - Elements) & 3, (7 - Elements) & 3>(V);
3050 #endif
3051 }
3052
3053 template<UINT VSLeftRotateElements, UINT Select0, UINT Select1, UINT Select2, UINT Select3>
3054     inline XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS)
3055 {
3056 #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
3057 #else
3058     XMVECTOR Control = XMVectorSelectControl(Select0&1, Select1&1, Select2&1, Select3&1);
3059     return XMVectorSelect( VD, XMVectorRotateLeft<VSLeftRotateElements>(VS), Control );
3060 #endif
3061 }
3062
3063 #endif // __cplusplus
3064
3065 /****************************************************************************
3066  *
3067  * Globals
3068  *
3069  ****************************************************************************/
3070
3071 // The purpose of the following global constants is to prevent redundant 
3072 // reloading of the constants when they are referenced by more than one
3073 // separate inline math routine called within the same function.  Declaring
3074 // a constant locally within a routine is sufficient to prevent redundant
3075 // reloads of that constant when that single routine is called multiple
3076 // times in a function, but if the constant is used (and declared) in a 
3077 // separate math routine it would be reloaded.
3078
3079 #define XMGLOBALCONST extern CONST __declspec(selectany)
3080
3081 XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients0    = {1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f};
3082 XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients1    = {2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f};
3083 XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients2    = {2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f};
3084 XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients0    = {1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f};
3085 XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients1    = {2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f};
3086 XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients2    = {4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f};
3087 XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients0    = {1.0f, 0.333333333f, 0.133333333f, 5.396825397e-2f};
3088 XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients1    = {2.186948854e-2f, 8.863235530e-3f, 3.592128167e-3f, 1.455834485e-3f};
3089 XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients2    = {5.900274264e-4f, 2.391290764e-4f, 9.691537707e-5f, 3.927832950e-5f};
3090 XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients0   = {-0.05806367563904f, -0.41861972469416f, 0.22480114791621f, 2.17337241360606f};
3091 XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients1   = {0.61657275907170f, 4.29696498283455f, -1.18942822255452f, -6.53784832094831f};
3092 XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients2   = {-1.36926553863413f, -4.48179294237210f, 1.41810672941833f, 5.48179257935713f};
3093 XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients0   = {1.0f, 0.333333334f, 0.2f, 0.142857143f};
3094 XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients1   = {1.111111111e-1f, 9.090909091e-2f, 7.692307692e-2f, 6.666666667e-2f};
3095 XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients2   = {5.882352941e-2f, 5.263157895e-2f, 4.761904762e-2f, 4.347826087e-2f};
3096 XMGLOBALCONST XMVECTORF32 g_XMSinEstCoefficients  = {1.0f, -1.66521856991541e-1f, 8.199913018755e-3f, -1.61475937228e-4f};
3097 XMGLOBALCONST XMVECTORF32 g_XMCosEstCoefficients  = {1.0f, -4.95348008918096e-1f, 3.878259962881e-2f, -9.24587976263e-4f};
3098 XMGLOBALCONST XMVECTORF32 g_XMTanEstCoefficients  = {2.484f, -1.954923183e-1f, 2.467401101f, XM_1DIVPI};
3099 XMGLOBALCONST XMVECTORF32 g_XMATanEstCoefficients = {7.689891418951e-1f, 1.104742493348f, 8.661844266006e-1f, XM_PIDIV2};
3100 XMGLOBALCONST XMVECTORF32 g_XMASinEstCoefficients = {-1.36178272886711f, 2.37949493464538f, -8.08228565650486e-1f, 2.78440142746736e-1f};
3101 XMGLOBALCONST XMVECTORF32 g_XMASinEstConstants    = {1.00000011921f, XM_PIDIV2, 0.0f, 0.0f};
3102 XMGLOBALCONST XMVECTORF32 g_XMPiConstants0        = {XM_PI, XM_2PI, XM_1DIVPI, XM_1DIV2PI};
3103 XMGLOBALCONST XMVECTORF32 g_XMIdentityR0          = {1.0f, 0.0f, 0.0f, 0.0f};
3104 XMGLOBALCONST XMVECTORF32 g_XMIdentityR1          = {0.0f, 1.0f, 0.0f, 0.0f};
3105 XMGLOBALCONST XMVECTORF32 g_XMIdentityR2          = {0.0f, 0.0f, 1.0f, 0.0f};
3106 XMGLOBALCONST XMVECTORF32 g_XMIdentityR3          = {0.0f, 0.0f, 0.0f, 1.0f};
3107 XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR0       = {-1.0f,0.0f, 0.0f, 0.0f};
3108 XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR1       = {0.0f,-1.0f, 0.0f, 0.0f};
3109 XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR2       = {0.0f, 0.0f,-1.0f, 0.0f};
3110 XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR3       = {0.0f, 0.0f, 0.0f,-1.0f};
3111 XMGLOBALCONST XMVECTORI32 g_XMNegativeZero      = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
3112 XMGLOBALCONST XMVECTORI32 g_XMNegate3           = {0x80000000, 0x80000000, 0x80000000, 0x00000000};
3113 XMGLOBALCONST XMVECTORI32 g_XMMask3             = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000};
3114 XMGLOBALCONST XMVECTORI32 g_XMMaskX             = {0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000};
3115 XMGLOBALCONST XMVECTORI32 g_XMMaskY             = {0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000};
3116 XMGLOBALCONST XMVECTORI32 g_XMMaskZ             = {0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000};
3117 XMGLOBALCONST XMVECTORI32 g_XMMaskW             = {0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF};
3118 XMGLOBALCONST XMVECTORF32 g_XMOne               = { 1.0f, 1.0f, 1.0f, 1.0f};
3119 XMGLOBALCONST XMVECTORF32 g_XMOne3              = { 1.0f, 1.0f, 1.0f, 0.0f};
3120 XMGLOBALCONST XMVECTORF32 g_XMZero              = { 0.0f, 0.0f, 0.0f, 0.0f};
3121 XMGLOBALCONST XMVECTORF32 g_XMNegativeOne       = {-1.0f,-1.0f,-1.0f,-1.0f};
3122 XMGLOBALCONST XMVECTORF32 g_XMOneHalf           = { 0.5f, 0.5f, 0.5f, 0.5f};
3123 XMGLOBALCONST XMVECTORF32 g_XMNegativeOneHalf   = {-0.5f,-0.5f,-0.5f,-0.5f};
3124 XMGLOBALCONST XMVECTORF32 g_XMNegativeTwoPi     = {-XM_2PI, -XM_2PI, -XM_2PI, -XM_2PI};
3125 XMGLOBALCONST XMVECTORF32 g_XMNegativePi        = {-XM_PI, -XM_PI, -XM_PI, -XM_PI};
3126 XMGLOBALCONST XMVECTORF32 g_XMHalfPi            = {XM_PIDIV2, XM_PIDIV2, XM_PIDIV2, XM_PIDIV2};
3127 XMGLOBALCONST XMVECTORF32 g_XMPi                = {XM_PI, XM_PI, XM_PI, XM_PI};
3128 XMGLOBALCONST XMVECTORF32 g_XMReciprocalPi      = {XM_1DIVPI, XM_1DIVPI, XM_1DIVPI, XM_1DIVPI};
3129 XMGLOBALCONST XMVECTORF32 g_XMTwoPi             = {XM_2PI, XM_2PI, XM_2PI, XM_2PI};
3130 XMGLOBALCONST XMVECTORF32 g_XMReciprocalTwoPi   = {XM_1DIV2PI, XM_1DIV2PI, XM_1DIV2PI, XM_1DIV2PI};
3131 XMGLOBALCONST XMVECTORF32 g_XMEpsilon           = {1.192092896e-7f, 1.192092896e-7f, 1.192092896e-7f, 1.192092896e-7f};
3132 XMGLOBALCONST XMVECTORI32 g_XMInfinity          = {0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000};
3133 XMGLOBALCONST XMVECTORI32 g_XMQNaN              = {0x7FC00000, 0x7FC00000, 0x7FC00000, 0x7FC00000};
3134 XMGLOBALCONST XMVECTORI32 g_XMQNaNTest          = {0x007FFFFF, 0x007FFFFF, 0x007FFFFF, 0x007FFFFF};
3135 XMGLOBALCONST XMVECTORI32 g_XMAbsMask           = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
3136 XMGLOBALCONST XMVECTORI32 g_XMFltMin            = {0x00800000, 0x00800000, 0x00800000, 0x00800000};
3137 XMGLOBALCONST XMVECTORI32 g_XMFltMax            = {0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF};
3138 XMGLOBALCONST XMVECTORI32 g_XMNegOneMask                = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
3139 XMGLOBALCONST XMVECTORI32 g_XMMaskA8R8G8B8      = {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000};
3140 XMGLOBALCONST XMVECTORI32 g_XMFlipA8R8G8B8      = {0x00000000, 0x00000000, 0x00000000, 0x80000000};
3141 XMGLOBALCONST XMVECTORF32 g_XMFixAA8R8G8B8      = {0.0f,0.0f,0.0f,(float)(0x80000000U)};
3142 XMGLOBALCONST XMVECTORF32 g_XMNormalizeA8R8G8B8 = {1.0f/(255.0f*(float)(0x10000)),1.0f/(255.0f*(float)(0x100)),1.0f/255.0f,1.0f/(255.0f*(float)(0x1000000))};
3143 XMGLOBALCONST XMVECTORI32 g_XMMaskA2B10G10R10   = {0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000};
3144 XMGLOBALCONST XMVECTORI32 g_XMFlipA2B10G10R10   = {0x00000200, 0x00080000, 0x20000000, 0x80000000};
3145 XMGLOBALCONST XMVECTORF32 g_XMFixAA2B10G10R10   = {-512.0f,-512.0f*(float)(0x400),-512.0f*(float)(0x100000),(float)(0x80000000U)};
3146 XMGLOBALCONST XMVECTORF32 g_XMNormalizeA2B10G10R10 = {1.0f/511.0f,1.0f/(511.0f*(float)(0x400)),1.0f/(511.0f*(float)(0x100000)),1.0f/(3.0f*(float)(0x40000000))};
3147 XMGLOBALCONST XMVECTORI32 g_XMMaskX16Y16        = {0x0000FFFF, 0xFFFF0000, 0x00000000, 0x00000000};
3148 XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16        = {0x00008000, 0x00000000, 0x00000000, 0x00000000};
3149 XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16         = {-32768.0f,0.0f,0.0f,0.0f};
3150 XMGLOBALCONST XMVECTORF32 g_XMNormalizeX16Y16   = {1.0f/32767.0f,1.0f/(32767.0f*65536.0f),0.0f,0.0f};
3151 XMGLOBALCONST XMVECTORI32 g_XMMaskX16Y16Z16W16  = {0x0000FFFF, 0x0000FFFF, 0xFFFF0000, 0xFFFF0000};
3152 XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16Z16W16  = {0x00008000, 0x00008000, 0x00000000, 0x00000000};
3153 XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16Z16W16   = {-32768.0f,-32768.0f,0.0f,0.0f};
3154 XMGLOBALCONST XMVECTORF32 g_XMNormalizeX16Y16Z16W16 = {1.0f/32767.0f,1.0f/32767.0f,1.0f/(32767.0f*65536.0f),1.0f/(32767.0f*65536.0f)};
3155 XMGLOBALCONST XMVECTORF32 g_XMNoFraction        = {8388608.0f,8388608.0f,8388608.0f,8388608.0f};
3156 XMGLOBALCONST XMVECTORI32 g_XMMaskByte          = {0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF};
3157 XMGLOBALCONST XMVECTORF32 g_XMNegateX           = {-1.0f, 1.0f, 1.0f, 1.0f};
3158 XMGLOBALCONST XMVECTORF32 g_XMNegateY           = { 1.0f,-1.0f, 1.0f, 1.0f};
3159 XMGLOBALCONST XMVECTORF32 g_XMNegateZ           = { 1.0f, 1.0f,-1.0f, 1.0f};
3160 XMGLOBALCONST XMVECTORF32 g_XMNegateW           = { 1.0f, 1.0f, 1.0f,-1.0f};
3161 XMGLOBALCONST XMVECTORI32 g_XMSelect0101        = {XM_SELECT_0, XM_SELECT_1, XM_SELECT_0, XM_SELECT_1};
3162 XMGLOBALCONST XMVECTORI32 g_XMSelect1010        = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_1, XM_SELECT_0};
3163 XMGLOBALCONST XMVECTORI32 g_XMOneHalfMinusEpsilon = { 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD};
3164 XMGLOBALCONST XMVECTORI32 g_XMSelect1000        = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_0, XM_SELECT_0};
3165 XMGLOBALCONST XMVECTORI32 g_XMSelect1100        = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_0, XM_SELECT_0};
3166 XMGLOBALCONST XMVECTORI32 g_XMSelect1110        = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_1, XM_SELECT_0};
3167 XMGLOBALCONST XMVECTORI32 g_XMSwizzleXYXY       = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0Y};
3168 XMGLOBALCONST XMVECTORI32 g_XMSwizzleXYZX       = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X};
3169 XMGLOBALCONST XMVECTORI32 g_XMSwizzleYXZW       = {XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0Z, XM_PERMUTE_0W};
3170 XMGLOBALCONST XMVECTORI32 g_XMSwizzleYZXW       = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0W};
3171 XMGLOBALCONST XMVECTORI32 g_XMSwizzleZXYW       = {XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W};
3172 XMGLOBALCONST XMVECTORI32 g_XMPermute0X0Y1X1Y   = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_1Y};
3173 XMGLOBALCONST XMVECTORI32 g_XMPermute0Z0W1Z1W   = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_1Z, XM_PERMUTE_1W};
3174 XMGLOBALCONST XMVECTORF32 g_XMFixupY16          = {1.0f,1.0f/65536.0f,0.0f,0.0f};
3175 XMGLOBALCONST XMVECTORF32 g_XMFixupY16W16       = {1.0f,1.0f,1.0f/65536.0f,1.0f/65536.0f};
3176 XMGLOBALCONST XMVECTORI32 g_XMFlipY             = {0,0x80000000,0,0};
3177 XMGLOBALCONST XMVECTORI32 g_XMFlipZ             = {0,0,0x80000000,0};
3178 XMGLOBALCONST XMVECTORI32 g_XMFlipW             = {0,0,0,0x80000000};
3179 XMGLOBALCONST XMVECTORI32 g_XMFlipYZ            = {0,0x80000000,0x80000000,0};
3180 XMGLOBALCONST XMVECTORI32 g_XMFlipZW            = {0,0,0x80000000,0x80000000};
3181 XMGLOBALCONST XMVECTORI32 g_XMFlipYW            = {0,0x80000000,0,0x80000000};
3182 XMGLOBALCONST XMVECTORI32 g_XMMaskHenD3         = {0x7FF,0x7ff<<11,0x3FF<<22,0};
3183 XMGLOBALCONST XMVECTORI32 g_XMMaskDHen3         = {0x3FF,0x7ff<<10,0x7FF<<21,0};
3184 XMGLOBALCONST XMVECTORF32 g_XMAddUHenD3         = {0,0,32768.0f*65536.0f,0};
3185 XMGLOBALCONST XMVECTORF32 g_XMAddHenD3          = {-1024.0f,-1024.0f*2048.0f,0,0};
3186 XMGLOBALCONST XMVECTORF32 g_XMAddDHen3          = {-512.0f,-1024.0f*1024.0f,0,0};
3187 XMGLOBALCONST XMVECTORF32 g_XMMulHenD3          = {1.0f,1.0f/2048.0f,1.0f/(2048.0f*2048.0f),0};
3188 XMGLOBALCONST XMVECTORF32 g_XMMulDHen3          = {1.0f,1.0f/1024.0f,1.0f/(1024.0f*2048.0f),0};
3189 XMGLOBALCONST XMVECTORI32 g_XMXorHenD3          = {0x400,0x400<<11,0,0};
3190 XMGLOBALCONST XMVECTORI32 g_XMXorDHen3          = {0x200,0x400<<10,0,0};
3191 XMGLOBALCONST XMVECTORI32 g_XMMaskIco4          = {0xFFFFF,0xFFFFF000,0xFFFFF,0xF0000000};
3192 XMGLOBALCONST XMVECTORI32 g_XMXorXIco4          = {0x80000,0,0x80000,0x80000000};
3193 XMGLOBALCONST XMVECTORI32 g_XMXorIco4           = {0x80000,0,0x80000,0};
3194 XMGLOBALCONST XMVECTORF32 g_XMAddXIco4          = {-8.0f*65536.0f,0,-8.0f*65536.0f,32768.0f*65536.0f};
3195 XMGLOBALCONST XMVECTORF32 g_XMAddUIco4          = {0,32768.0f*65536.0f,0,32768.0f*65536.0f};
3196 XMGLOBALCONST XMVECTORF32 g_XMAddIco4           = {-8.0f*65536.0f,0,-8.0f*65536.0f,0};
3197 XMGLOBALCONST XMVECTORF32 g_XMMulIco4           = {1.0f,1.0f/4096.0f,1.0f,1.0f/(4096.0f*65536.0f)};
3198 XMGLOBALCONST XMVECTORI32 g_XMMaskDec4          = {0x3FF,0x3FF<<10,0x3FF<<20,0x3<<30};
3199 XMGLOBALCONST XMVECTORI32 g_XMXorDec4           = {0x200,0x200<<10,0x200<<20,0};
3200 XMGLOBALCONST XMVECTORF32 g_XMAddUDec4          = {0,0,0,32768.0f*65536.0f};
3201 XMGLOBALCONST XMVECTORF32 g_XMAddDec4           = {-512.0f,-512.0f*1024.0f,-512.0f*1024.0f*1024.0f,0};
3202 XMGLOBALCONST XMVECTORF32 g_XMMulDec4           = {1.0f,1.0f/1024.0f,1.0f/(1024.0f*1024.0f),1.0f/(1024.0f*1024.0f*1024.0f)};
3203 XMGLOBALCONST XMVECTORI32 g_XMMaskByte4         = {0xFF,0xFF00,0xFF0000,0xFF000000};
3204 XMGLOBALCONST XMVECTORI32 g_XMXorByte4          = {0x80,0x8000,0x800000,0x00000000};
3205 XMGLOBALCONST XMVECTORF32 g_XMAddByte4          = {-128.0f,-128.0f*256.0f,-128.0f*65536.0f,0};
3206 XMGLOBALCONST XMVECTORF32 g_XMFixUnsigned       = {32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f};
3207 XMGLOBALCONST XMVECTORF32 g_XMMaxInt            = {65536.0f*32768.0f-128.0f,65536.0f*32768.0f-128.0f,65536.0f*32768.0f-128.0f,65536.0f*32768.0f-128.0f};
3208 XMGLOBALCONST XMVECTORF32 g_XMMaxUInt           = {65536.0f*65536.0f-256.0f,65536.0f*65536.0f-256.0f,65536.0f*65536.0f-256.0f,65536.0f*65536.0f-256.0f};
3209 XMGLOBALCONST XMVECTORF32 g_XMUnsignedFix       = {32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f};
3210
3211
3212 /****************************************************************************
3213  *
3214  * Implementation
3215  *
3216  ****************************************************************************/
3217
3218 #pragma warning(push)
3219 #pragma warning(disable:4068 4214 4204 4365 4616 6001)
3220
3221 #pragma prefast(push)
3222 #pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes")
3223
3224 #if !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_)
3225
3226 /* Work around VC 2005 bug where math.h defines logf with a semicolon at the end.
3227  * Note this is fixed as of Visual Studio 2005 Service Pack 1
3228  */
3229
3230 #undef logf
3231 #define logf(x)     ((float)log((double)(x)))
3232
3233 #endif // !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_)
3234
3235
3236 //------------------------------------------------------------------------------
3237
3238 #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_)
3239 #else
3240
3241 XMFINLINE XMVECTOR XMVectorSetBinaryConstant(UINT C0, UINT C1, UINT C2, UINT C3)
3242 {
3243 #if defined(_XM_NO_INTRINSICS_)
3244     XMVECTORU32 vResult;
3245     vResult.u[0] = (0-(C0&1)) & 0x3F800000;
3246     vResult.u[1] = (0-(C1&1)) & 0x3F800000;
3247     vResult.u[2] = (0-(C2&1)) & 0x3F800000;
3248     vResult.u[3] = (0-(C3&1)) & 0x3F800000;
3249     return vResult.v;
3250 #else // XM_SSE_INTRINSICS_
3251     static const XMVECTORU32 g_vMask1 = {1,1,1,1};
3252     // Move the parms to a vector
3253     __m128i vTemp = _mm_set_epi32(C3,C2,C1,C0);
3254     // Mask off the low bits
3255     vTemp = _mm_and_si128(vTemp,g_vMask1);
3256     // 0xFFFFFFFF on true bits
3257     vTemp = _mm_cmpeq_epi32(vTemp,g_vMask1);
3258     // 0xFFFFFFFF -> 1.0f, 0x00000000 -> 0.0f
3259     vTemp = _mm_and_si128(vTemp,g_XMOne);
3260     return reinterpret_cast<const __m128 *>(&vTemp)[0];
3261 #endif
3262 }
3263
3264 //------------------------------------------------------------------------------
3265
3266 XMFINLINE XMVECTOR XMVectorSplatConstant(INT IntConstant, UINT DivExponent)
3267 {
3268 #if defined(_XM_NO_INTRINSICS_)
3269     XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
3270     XMASSERT(DivExponent<32);
3271     {
3272     XMVECTORI32 V = { IntConstant, IntConstant, IntConstant, IntConstant };
3273     return XMConvertVectorIntToFloat( V.v, DivExponent);
3274     }
3275 #else // XM_SSE_INTRINSICS_
3276     XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
3277     XMASSERT(DivExponent<32);
3278     // Splat the int
3279     __m128i vScale = _mm_set1_epi32(IntConstant);
3280     // Convert to a float
3281     XMVECTOR vResult = _mm_cvtepi32_ps(vScale);
3282     // Convert DivExponent into 1.0f/(1<<DivExponent)
3283     UINT uScale = 0x3F800000U - (DivExponent << 23);
3284     // Splat the scalar value (It's really a float)
3285     vScale = _mm_set1_epi32(uScale);
3286     // Multiply by the reciprocal (Perform a right shift by DivExponent)
3287     vResult = _mm_mul_ps(vResult,reinterpret_cast<const __m128 *>(&vScale)[0]);
3288     return vResult;
3289 #endif
3290 }
3291
3292 //------------------------------------------------------------------------------
3293
3294 XMFINLINE XMVECTOR XMVectorSplatConstantInt(INT IntConstant)
3295 {
3296 #if defined(_XM_NO_INTRINSICS_)
3297     XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
3298     {
3299     XMVECTORI32 V = { IntConstant, IntConstant, IntConstant, IntConstant };
3300     return V.v;
3301     }
3302 #else // XM_SSE_INTRINSICS_
3303     XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
3304     __m128i V = _mm_set1_epi32( IntConstant );
3305     return reinterpret_cast<__m128 *>(&V)[0];
3306 #endif
3307 }
3308
3309 //------------------------------------------------------------------------------
3310
3311 XMFINLINE XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2, UINT Elements)
3312 {
3313     return XMVectorPermute(V1, V2, XMVectorPermuteControl((Elements), ((Elements) + 1), ((Elements) + 2), ((Elements) + 3)));
3314 }
3315
3316 //------------------------------------------------------------------------------
3317
3318 XMFINLINE XMVECTOR XMVectorRotateLeft(FXMVECTOR V, UINT Elements)
3319 {
3320 #if defined(_XM_NO_INTRINSICS_)
3321     XMASSERT( Elements < 4 );
3322     {
3323     XMVECTORF32 vResult = { V.vector4_f32[Elements & 3], V.vector4_f32[(Elements + 1) & 3],
3324                             V.vector4_f32[(Elements + 2) & 3], V.vector4_f32[(Elements + 3) & 3] };
3325     return vResult.v;
3326     }
3327 #else // XM_SSE_INTRINSICS_
3328     FLOAT fx = XMVectorGetByIndex(V,(Elements) & 3);
3329     FLOAT fy = XMVectorGetByIndex(V,((Elements) + 1) & 3);
3330     FLOAT fz = XMVectorGetByIndex(V,((Elements) + 2) & 3);
3331     FLOAT fw = XMVectorGetByIndex(V,((Elements) + 3) & 3);
3332     return _mm_set_ps( fw, fz, fy, fx );
3333 #endif
3334 }
3335
3336 //------------------------------------------------------------------------------
3337
3338 XMFINLINE XMVECTOR XMVectorRotateRight(FXMVECTOR V, UINT Elements)
3339 {
3340 #if defined(_XM_NO_INTRINSICS_)
3341     XMASSERT( Elements < 4 );
3342     {
3343     XMVECTORF32 vResult = { V.vector4_f32[(4 - (Elements)) & 3], V.vector4_f32[(5 - (Elements)) & 3],
3344                             V.vector4_f32[(6 - (Elements)) & 3], V.vector4_f32[(7 - (Elements)) & 3] };
3345     return vResult.v;
3346     }
3347 #else // XM_SSE_INTRINSICS_
3348     FLOAT fx = XMVectorGetByIndex(V,(4 - (Elements)) & 3);
3349     FLOAT fy = XMVectorGetByIndex(V,(5 - (Elements)) & 3);
3350     FLOAT fz = XMVectorGetByIndex(V,(6 - (Elements)) & 3);
3351     FLOAT fw = XMVectorGetByIndex(V,(7 - (Elements)) & 3);
3352     return _mm_set_ps( fw, fz, fy, fx );
3353 #endif
3354 }
3355
3356 //------------------------------------------------------------------------------
3357
3358 XMFINLINE XMVECTOR XMVectorSwizzle(FXMVECTOR V, UINT E0, UINT E1, UINT E2, UINT E3)
3359 {
3360 #if defined(_XM_NO_INTRINSICS_)
3361     XMASSERT( (E0 < 4) && (E1 < 4) && (E2 < 4) && (E3 < 4) );
3362     {
3363     XMVECTORF32 vResult = { V.vector4_f32[E0], V.vector4_f32[E1], V.vector4_f32[E2], V.vector4_f32[E3] };
3364     return vResult.v;
3365     }
3366 #else // XM_SSE_INTRINSICS_
3367     FLOAT fx = XMVectorGetByIndex(V,E0);
3368     FLOAT fy = XMVectorGetByIndex(V,E1);
3369     FLOAT fz = XMVectorGetByIndex(V,E2);
3370     FLOAT fw = XMVectorGetByIndex(V,E3);
3371     return _mm_set_ps( fw, fz, fy, fx );
3372 #endif
3373 }
3374
3375 //------------------------------------------------------------------------------
3376
3377 XMFINLINE XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateElements,
3378                                   UINT Select0, UINT Select1, UINT Select2, UINT Select3)
3379 {
3380     XMVECTOR Control = XMVectorSelectControl(Select0&1, Select1&1, Select2&1, Select3&1);
3381     return XMVectorSelect( VD, XMVectorRotateLeft(VS, VSLeftRotateElements), Control );
3382 }
3383
3384 #endif
3385
3386 //------------------------------------------------------------------------------
3387
3388 #include "xnamathconvert.inl"
3389 #include "xnamathvector.inl"
3390 #include "xnamathmatrix.inl"
3391 #include "xnamathmisc.inl"
3392
3393 #pragma prefast(pop)
3394 #pragma warning(pop)
3395
3396 #endif // __XNAMATH_H__
3397