Skip to content

Commit 9a1e0b5

Browse files
committed
XNAMath 2.02
1 parent 9521deb commit 9a1e0b5

5 files changed

Lines changed: 208 additions & 276 deletions

File tree

Inc/xnamath.h

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Module Name:
2222
#error XNAMATH and XBOXMATH are incompatible in the same compilation module. Use one or the other.
2323
#endif
2424

25-
#define XNAMATH_VERSION 201
25+
#define XNAMATH_VERSION 202
2626

2727
#if !defined(_XM_X64_) && !defined(_XM_X86_)
2828
#if defined(_M_AMD64) || defined(_AMD64_)
@@ -32,6 +32,16 @@ Module Name:
3232
#endif
3333
#endif
3434

35+
#if !defined(_XM_BIGENDIAN_) && !defined(_XM_LITTLEENDIAN_)
36+
#if defined(_XM_X64_) || defined(_XM_X86_)
37+
#define _XM_LITTLEENDIAN_
38+
#elif defined(_XBOX_VER)
39+
#define _XM_BIGENDIAN_
40+
#else
41+
#error xnamath.h only supports x86, x64, or XBox 360 targets
42+
#endif
43+
#endif
44+
3545
#if defined(_XM_X86_) || defined(_XM_X64_)
3646
#define _XM_SSE_INTRINSICS_
3747
#if !defined(__cplusplus) && !defined(_XM_NO_INTRINSICS_)
@@ -174,7 +184,7 @@ XMFINLINE FLOAT XMConvertToDegrees(FLOAT fRadians) { return fRadians * (180.0f /
174184
****************************************************************************/
175185

176186
#pragma warning(push)
177-
#pragma warning(disable:4201)
187+
#pragma warning(disable:4201 4365)
178188

179189
#if !defined (_XM_X86_) && !defined(_XM_X64_)
180190
#pragma bitfield_order(push)
@@ -278,9 +288,9 @@ typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU32 {
278288
} XMVECTORU32;
279289

280290
// Fix-up for (1st-3rd) XMVECTOR parameters that are pass-in-register for x86 and Xbox 360, but not for other targets
281-
#if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINISCS_)
291+
#if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
282292
typedef const XMVECTOR FXMVECTOR;
283-
#elif defined(_XM_X86_) && !defined(_XM_NO_INTRINISCS_)
293+
#elif defined(_XM_X86_) && !defined(_XM_NO_INTRINSICS_)
284294
typedef const XMVECTOR FXMVECTOR;
285295
#elif defined(__cplusplus)
286296
typedef const XMVECTOR& FXMVECTOR;
@@ -289,7 +299,7 @@ typedef const XMVECTOR FXMVECTOR;
289299
#endif
290300

291301
// Fix-up for (4th+) XMVECTOR parameters to pass in-register for Xbox 360 and by reference otherwise
292-
#if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINISCS_)
302+
#if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
293303
typedef const XMVECTOR CXMVECTOR;
294304
#elif defined(__cplusplus)
295305
typedef const XMVECTOR& CXMVECTOR;
@@ -354,11 +364,11 @@ typedef _DECLSPEC_ALIGN_16_ struct _XMMATRIX
354364
FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; }
355365
FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; }
356366

357-
_XMMATRIX& operator= (CONST _XMMATRIX&);
367+
_XMMATRIX& operator= (CONST _XMMATRIX& M);
358368

359369
#ifndef XM_NO_OPERATOR_OVERLOADS
360-
_XMMATRIX& operator*= (CONST _XMMATRIX&);
361-
_XMMATRIX operator* (CONST _XMMATRIX&) CONST;
370+
_XMMATRIX& operator*= (CONST _XMMATRIX& M);
371+
_XMMATRIX operator* (CONST _XMMATRIX& M) CONST;
362372
#endif // !XM_NO_OPERATOR_OVERLOADS
363373

364374
#endif // __cplusplus
@@ -1500,7 +1510,7 @@ typedef struct _XMCOLOR
15001510

15011511
_XMCOLOR() {};
15021512
_XMCOLOR(UINT Color) : c(Color) {};
1503-
_XMCOLOR(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
1513+
_XMCOLOR(FLOAT _r, FLOAT _g, FLOAT _b, FLOAT _a);
15041514
_XMCOLOR(CONST FLOAT *pArray);
15051515

15061516
operator UINT () { return c; }
@@ -2582,9 +2592,6 @@ XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR0 = {-1.0f,0.0f, 0.0f, 0.0f};
25822592
XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR1 = {0.0f,-1.0f, 0.0f, 0.0f};
25832593
XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR2 = {0.0f, 0.0f,-1.0f, 0.0f};
25842594
XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR3 = {0.0f, 0.0f, 0.0f,-1.0f};
2585-
2586-
#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_)
2587-
25882595
XMGLOBALCONST XMVECTORI32 g_XMNegativeZero = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
25892596
XMGLOBALCONST XMVECTORI32 g_XMNegate3 = {0x80000000, 0x80000000, 0x80000000, 0x00000000};
25902597
XMGLOBALCONST XMVECTORI32 g_XMMask3 = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000};
@@ -2638,8 +2645,6 @@ XMGLOBALCONST XMVECTORF32 g_XMNegateW = { 1.0f, 1.0f, 1.0f,-1.0f};
26382645
XMGLOBALCONST XMVECTORI32 g_XMSelect0101 = {XM_SELECT_0, XM_SELECT_1, XM_SELECT_0, XM_SELECT_1};
26392646
XMGLOBALCONST XMVECTORI32 g_XMSelect1010 = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_1, XM_SELECT_0};
26402647
XMGLOBALCONST XMVECTORI32 g_XMOneHalfMinusEpsilon = { 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD};
2641-
2642-
#ifdef _XM_NO_INTRINSICS_
26432648
XMGLOBALCONST XMVECTORI32 g_XMSelect1000 = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_0, XM_SELECT_0};
26442649
XMGLOBALCONST XMVECTORI32 g_XMSelect1100 = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_0, XM_SELECT_0};
26452650
XMGLOBALCONST XMVECTORI32 g_XMSelect1110 = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_1, XM_SELECT_0};
@@ -2650,9 +2655,6 @@ XMGLOBALCONST XMVECTORI32 g_XMSwizzleYZXW = {XM_PERMUTE_0Y, XM_PERMUTE_0Z,
26502655
XMGLOBALCONST XMVECTORI32 g_XMSwizzleZXYW = {XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W};
26512656
XMGLOBALCONST XMVECTORI32 g_XMPermute0X0Y1X1Y = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_1Y};
26522657
XMGLOBALCONST XMVECTORI32 g_XMPermute0Z0W1Z1W = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_1Z, XM_PERMUTE_1W};
2653-
#endif // !_XM_NO_INTRINSICS_
2654-
2655-
#ifdef _XM_SSE_INTRINSICS_
26562658
XMGLOBALCONST XMVECTORF32 g_XMFixupY16 = {1.0f,1.0f/65536.0f,0.0f,0.0f};
26572659
XMGLOBALCONST XMVECTORF32 g_XMFixupY16W16 = {1.0f,1.0f,1.0f/65536.0f,1.0f/65536.0f};
26582660
XMGLOBALCONST XMVECTORI32 g_XMFlipY = {0,0x80000000,0,0};
@@ -2685,9 +2687,6 @@ XMGLOBALCONST XMVECTORF32 g_XMMulDec4 = {1.0f,1.0f/1024.0f,1.0f/(1024.
26852687
XMGLOBALCONST XMVECTORI32 g_XMMaskByte4 = {0xFF,0xFF00,0xFF0000,0xFF000000};
26862688
XMGLOBALCONST XMVECTORI32 g_XMXorByte4 = {0x80,0x8000,0x800000,0x00000000};
26872689
XMGLOBALCONST XMVECTORF32 g_XMAddByte4 = {-128.0f,-128.0f*256.0f,-128.0f*65536.0f,0};
2688-
#endif
2689-
2690-
#endif // _XM_NO_INTRINSICS_
26912690

26922691
/****************************************************************************
26932692
*
@@ -2696,7 +2695,7 @@ XMGLOBALCONST XMVECTORF32 g_XMAddByte4 = {-128.0f,-128.0f*256.0f,-128.0
26962695
****************************************************************************/
26972696

26982697
#pragma warning(push)
2699-
#pragma warning(disable:4214 4204 4616 6001)
2698+
#pragma warning(disable:4214 4204 4365 4616 6001)
27002699

27012700
#if !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_)
27022701

@@ -2861,10 +2860,10 @@ XMFINLINE XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateE
28612860

28622861
//------------------------------------------------------------------------------
28632862

2864-
#include <xnamathconvert.inl>
2865-
#include <xnamathvector.inl>
2866-
#include <xnamathmatrix.inl>
2867-
#include <xnamathmisc.inl>
2863+
#include "xnamathconvert.inl"
2864+
#include "xnamathvector.inl"
2865+
#include "xnamathmatrix.inl"
2866+
#include "xnamathmisc.inl"
28682867

28692868
#pragma warning(pop)
28702869

0 commit comments

Comments
 (0)