Skip to content

Commit

Permalink
Fixed conformance warnings based on clang (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Jun 26, 2018
1 parent 2e08f92 commit 6883c55
Show file tree
Hide file tree
Showing 8 changed files with 516 additions and 493 deletions.
6 changes: 3 additions & 3 deletions Inc/DirectXCollision.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ enum ContainmentType
{
DISJOINT = 0,
INTERSECTS = 1,
CONTAINS = 2,
CONTAINS = 2
};

enum PlaneIntersectionType
{
FRONT = 0,
INTERSECTING = 1,
BACK = 2,
BACK = 2
};

struct BoundingBox;
Expand Down Expand Up @@ -319,7 +319,7 @@ namespace TriangleTests
_In_ GXMVECTOR Plane0, _In_ HXMVECTOR Plane1, _In_ HXMVECTOR Plane2,
_In_ CXMVECTOR Plane3, _In_ CXMVECTOR Plane4, _In_ CXMVECTOR Plane5 );
// Test a triangle against six planes at once (see BoundingFrustum::GetPlanes)
};
}

#pragma warning(pop)

Expand Down
16 changes: 8 additions & 8 deletions Inc/DirectXCollision.inl
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ inline XMVECTOR CalculateEigenVector( _In_ float m11, _In_ float m12, _In_ float
_In_ float m22, _In_ float m23, _In_ float m33, _In_ float e )
{
float fTmp[3];
fTmp[0] = ( float )( m12 * m23 - m13 * ( m22 - e ) );
fTmp[1] = ( float )( m13 * m12 - m23 * ( m11 - e ) );
fTmp[2] = ( float )( ( m11 - e ) * ( m22 - e ) - m12 * m12 );
fTmp[0] = m12 * m23 - m13 * ( m22 - e );
fTmp[1] = m13 * m12 - m23 * ( m11 - e );
fTmp[2] = ( m11 - e ) * ( m22 - e ) - m12 * m12;

XMVECTOR vTmp = XMLoadFloat3( reinterpret_cast<const XMFLOAT3*>(fTmp) );

Expand Down Expand Up @@ -236,11 +236,11 @@ inline XMVECTOR CalculateEigenVector( _In_ float m11, _In_ float m12, _In_ float
vTmp = XMVectorSetZ( vTmp, 0.0f );
// recalculate y to make equation work
if( m12 != 0 )
vTmp = XMVectorSetY( vTmp, ( float )( -f1 / f2 ) );
vTmp = XMVectorSetY( vTmp, -f1 / f2 );
}
else
{
vTmp = XMVectorSetZ( vTmp, ( float )( ( f2 - f1 ) / f3 ) );
vTmp = XMVectorSetZ( vTmp, ( f2 - f1 ) / f3 );
}
}

Expand Down Expand Up @@ -2006,7 +2006,7 @@ inline void XM_CALLCONV BoundingOrientedBox::Transform( BoundingOrientedBox& Out
_Use_decl_annotations_
inline void BoundingOrientedBox::GetCorners( XMFLOAT3* Corners ) const
{
assert( Corners != 0 );
assert( Corners != nullptr );

// Load the box
XMVECTOR vCenter = XMLoadFloat3( &Center );
Expand Down Expand Up @@ -2698,7 +2698,7 @@ _Use_decl_annotations_
inline void BoundingOrientedBox::CreateFromPoints( BoundingOrientedBox& Out, size_t Count, const XMFLOAT3* pPoints, size_t Stride )
{
assert( Count > 0 );
assert( pPoints != 0 );
assert( pPoints != nullptr );

XMVECTOR CenterOfMass = XMVectorZero();

Expand Down Expand Up @@ -2895,7 +2895,7 @@ inline void XM_CALLCONV BoundingFrustum::Transform( BoundingFrustum& Out, float
_Use_decl_annotations_
inline void BoundingFrustum::GetCorners( XMFLOAT3* Corners ) const
{
assert( Corners != 0 );
assert( Corners != nullptr );

// Load origin and orientation of the frustum.
XMVECTOR vOrigin = XMLoadFloat3( &Origin );
Expand Down
18 changes: 9 additions & 9 deletions Inc/DirectXMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ namespace Internal
{
static XMVECTOR XM_CALLCONV Permute(FXMVECTOR v1, FXMVECTOR v2) { return _mm_shuffle_ps(v2, v1, Shuffle); }
};
};
}

#endif // _XM_SSE_INTRINSICS_ && !_XM_NO_INTRINSICS_

Expand Down Expand Up @@ -1944,12 +1944,12 @@ XMGLOBALCONST XMVECTORI32 g_XMFltMax = { { { 0x7F7FFFFF, 0x7F7FFF
XMGLOBALCONST XMVECTORU32 g_XMNegOneMask = { { { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF } } };
XMGLOBALCONST XMVECTORU32 g_XMMaskA8R8G8B8 = { { { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 } } };
XMGLOBALCONST XMVECTORU32 g_XMFlipA8R8G8B8 = { { { 0x00000000, 0x00000000, 0x00000000, 0x80000000 } } };
XMGLOBALCONST XMVECTORF32 g_XMFixAA8R8G8B8 = { { { 0.0f, 0.0f, 0.0f, (float) (0x80000000U) } } };
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)) } } };
XMGLOBALCONST XMVECTORF32 g_XMFixAA8R8G8B8 = { { { 0.0f, 0.0f, 0.0f, float(0x80000000U) } } };
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)) } } };
XMGLOBALCONST XMVECTORU32 g_XMMaskA2B10G10R10 = { { { 0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000 } } };
XMGLOBALCONST XMVECTORU32 g_XMFlipA2B10G10R10 = { { { 0x00000200, 0x00080000, 0x20000000, 0x80000000 } } };
XMGLOBALCONST XMVECTORF32 g_XMFixAA2B10G10R10 = { { { -512.0f, -512.0f*(float) (0x400), -512.0f*(float) (0x100000), (float) (0x80000000U) } } };
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)) } } };
XMGLOBALCONST XMVECTORF32 g_XMFixAA2B10G10R10 = { { { -512.0f, -512.0f*float(0x400), -512.0f*float(0x100000), float(0x80000000U) } } };
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)) } } };
XMGLOBALCONST XMVECTORU32 g_XMMaskX16Y16 = { { { 0x0000FFFF, 0xFFFF0000, 0x00000000, 0x00000000 } } };
XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16 = { { { 0x00008000, 0x00000000, 0x00000000, 0x00000000 } } };
XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16 = { { { -32768.0f, 0.0f, 0.0f, 0.0f } } };
Expand Down Expand Up @@ -1979,7 +1979,7 @@ XMGLOBALCONST XMVECTORU32 g_XMFlipW = { { { 0, 0, 0, 0x80000000
XMGLOBALCONST XMVECTORU32 g_XMFlipYZ = { { { 0, 0x80000000, 0x80000000, 0 } } };
XMGLOBALCONST XMVECTORU32 g_XMFlipZW = { { { 0, 0, 0x80000000, 0x80000000 } } };
XMGLOBALCONST XMVECTORU32 g_XMFlipYW = { { { 0, 0x80000000, 0, 0x80000000 } } };
XMGLOBALCONST XMVECTORI32 g_XMMaskDec4 = { { { 0x3FF, 0x3FF << 10, 0x3FF << 20, 0x3 << 30 } } };
XMGLOBALCONST XMVECTORI32 g_XMMaskDec4 = { { { 0x3FF, 0x3FF << 10, 0x3FF << 20, static_cast<int>(0xC0000000) } } };
XMGLOBALCONST XMVECTORI32 g_XMXorDec4 = { { { 0x200, 0x200 << 10, 0x200 << 20, 0 } } };
XMGLOBALCONST XMVECTORF32 g_XMAddUDec4 = { { { 0, 0, 0, 32768.0f*65536.0f } } };
XMGLOBALCONST XMVECTORF32 g_XMAddDec4 = { { { -512.0f, -512.0f*1024.0f, -512.0f*1024.0f*1024.0f, 0 } } };
Expand Down Expand Up @@ -2067,7 +2067,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSetBinaryConstant(uint32_t C0, uint32_t C1,
#else // XM_SSE_INTRINSICS_
static const XMVECTORU32 g_vMask1 = { { { 1, 1, 1, 1 } } };
// Move the parms to a vector
__m128i vTemp = _mm_set_epi32(C3,C2,C1,C0);
__m128i vTemp = _mm_set_epi32(static_cast<int>(C3), static_cast<int>(C2), static_cast<int>(C1), static_cast<int>(C0));
// Mask off the low bits
vTemp = _mm_and_si128(vTemp,g_vMask1);
// 0xFFFFFFFF on true bits
Expand Down Expand Up @@ -2099,7 +2099,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSplatConstant(int32_t IntConstant, uint32_t
// Convert DivExponent into 1.0f/(1<<DivExponent)
uint32_t uScale = 0x3F800000U - (DivExponent << 23);
// Splat the scalar value (It's really a float)
vScale = vdupq_n_s32(uScale);
vScale = vdupq_n_u32(uScale);
// Multiply by the reciprocal (Perform a right shift by DivExponent)
vResult = vmulq_f32(vResult,reinterpret_cast<const float32x4_t *>(&vScale)[0]);
return vResult;
Expand All @@ -2111,7 +2111,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSplatConstant(int32_t IntConstant, uint32_t
// Convert DivExponent into 1.0f/(1<<DivExponent)
uint32_t uScale = 0x3F800000U - (DivExponent << 23);
// Splat the scalar value (It's really a float)
vScale = _mm_set1_epi32(uScale);
vScale = _mm_set1_epi32(static_cast<int>(uScale));
// Multiply by the reciprocal (Perform a right shift by DivExponent)
vResult = _mm_mul_ps(vResult,_mm_castsi128_ps(vScale));
return vResult;
Expand Down
Loading

0 comments on commit 6883c55

Please sign in to comment.