diff --git a/.github/linters/.clang-format b/.github/linters/.clang-format index 9b7998e..f4ebaed 100644 --- a/.github/linters/.clang-format +++ b/.github/linters/.clang-format @@ -80,3 +80,4 @@ SpacesInParentheses: false Standard: c++20 TabWidth: 4 UseTab: Never +QualifierAlignment: Right diff --git a/Extensions/DirectXMathAVX.h b/Extensions/DirectXMathAVX.h index 174735f..235561b 100644 --- a/Extensions/DirectXMathAVX.h +++ b/Extensions/DirectXMathAVX.h @@ -82,7 +82,7 @@ namespace DirectX _Analysis_assume_((E0 < 4) && (E1 < 4) && (E2 < 4) && (E3 < 4)); unsigned int elem[4] = { E0, E1, E2, E3 }; - __m128i vControl = _mm_loadu_si128(reinterpret_cast(&elem[0])); + __m128i vControl = _mm_loadu_si128(reinterpret_cast<__m128i const*>(&elem[0])); return _mm_permutevar_ps(V, vControl); } @@ -95,7 +95,7 @@ namespace DirectX static const XMVECTORU32 three = { { { 3, 3, 3, 3 } } }; XM_ALIGNED_DATA(16) unsigned int elem[4] = { PermuteX, PermuteY, PermuteZ, PermuteW }; - __m128i vControl = _mm_load_si128(reinterpret_cast(&elem[0])); + __m128i vControl = _mm_load_si128(reinterpret_cast<__m128i const*>(&elem[0])); __m128i vSelect = _mm_cmpgt_epi32(vControl, three); vControl = _mm_castps_si128(_mm_and_ps(_mm_castsi128_ps(vControl), three)); @@ -205,12 +205,12 @@ namespace DirectX static_assert(PermuteZ <= 7, "PermuteZ template parameter out of range"); static_assert(PermuteW <= 7, "PermuteW template parameter out of range"); - const uint32_t Shuffle = _MM_SHUFFLE(PermuteW & 3, PermuteZ & 3, PermuteY & 3, PermuteX & 3); + uint32_t const Shuffle = _MM_SHUFFLE(PermuteW & 3, PermuteZ & 3, PermuteY & 3, PermuteX & 3); - const bool WhichX = PermuteX > 3; - const bool WhichY = PermuteY > 3; - const bool WhichZ = PermuteZ > 3; - const bool WhichW = PermuteW > 3; + bool const WhichX = PermuteX > 3; + bool const WhichY = PermuteY > 3; + bool const WhichZ = PermuteZ > 3; + bool const WhichW = PermuteW > 3; return AVX::MathInternal::PermuteHelper::Permute(V1, V2); } diff --git a/Extensions/DirectXMathAVX2.h b/Extensions/DirectXMathAVX2.h index 7b14e1b..81fca84 100644 --- a/Extensions/DirectXMathAVX2.h +++ b/Extensions/DirectXMathAVX2.h @@ -102,7 +102,7 @@ namespace DirectX _Analysis_assume_((E0 < 4) && (E1 < 4) && (E2 < 4) && (E3 < 4)); unsigned int elem[4] = { E0, E1, E2, E3 }; - __m128i vControl = _mm_loadu_si128(reinterpret_cast(&elem[0])); + __m128i vControl = _mm_loadu_si128(reinterpret_cast<__m128i const*>(&elem[0])); return _mm_permutevar_ps(V, vControl); } @@ -115,7 +115,7 @@ namespace DirectX static const XMVECTORU32 three = { { { 3, 3, 3, 3 } } }; XM_ALIGNED_DATA(16) unsigned int elem[4] = { PermuteX, PermuteY, PermuteZ, PermuteW }; - __m128i vControl = _mm_load_si128(reinterpret_cast(&elem[0])); + __m128i vControl = _mm_load_si128(reinterpret_cast<__m128i const*>(&elem[0])); __m128i vSelect = _mm_cmpgt_epi32(vControl, three); vControl = _mm_castps_si128(_mm_and_ps(_mm_castsi128_ps(vControl), three)); @@ -235,8 +235,8 @@ namespace DirectX CXMMATRIX View, CXMMATRIX World) { - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMVECTOR Scale = XMVectorSet(HalfViewportWidth, -HalfViewportHeight, ViewportMaxZ - ViewportMinZ, 0.0f); XMVECTOR Offset = XMVectorSet(ViewportX + HalfViewportWidth, ViewportY + HalfViewportHeight, ViewportMinZ, 0.0f); @@ -493,12 +493,12 @@ namespace DirectX static_assert(PermuteZ <= 7, "PermuteZ template parameter out of range"); static_assert(PermuteW <= 7, "PermuteW template parameter out of range"); - const uint32_t Shuffle = _MM_SHUFFLE(PermuteW & 3, PermuteZ & 3, PermuteY & 3, PermuteX & 3); + uint32_t const Shuffle = _MM_SHUFFLE(PermuteW & 3, PermuteZ & 3, PermuteY & 3, PermuteX & 3); - const bool WhichX = PermuteX > 3; - const bool WhichY = PermuteY > 3; - const bool WhichZ = PermuteZ > 3; - const bool WhichW = PermuteW > 3; + bool const WhichX = PermuteX > 3; + bool const WhichY = PermuteY > 3; + bool const WhichZ = PermuteZ > 3; + bool const WhichW = PermuteW > 3; return AVX2::MathInternal::PermuteHelper::Permute(V1, V2); } @@ -680,7 +680,7 @@ namespace DirectX assert(InputStride >= sizeof(HALF)); assert(OutputStride >= sizeof(float)); - auto pHalf = reinterpret_cast(pInputStream); + auto pHalf = reinterpret_cast(pInputStream); auto pFloat = reinterpret_cast(pOutputStream); size_t i = 0; @@ -696,7 +696,7 @@ namespace DirectX // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -711,7 +711,7 @@ namespace DirectX // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -727,7 +727,7 @@ namespace DirectX // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -858,7 +858,7 @@ namespace DirectX assert(InputStride >= sizeof(float)); assert(OutputStride >= sizeof(HALF)); - auto pFloat = reinterpret_cast(pInputStream); + auto pFloat = reinterpret_cast(pInputStream); auto pHalf = reinterpret_cast(pOutputStream); size_t i = 0; @@ -874,7 +874,7 @@ namespace DirectX // Aligned and packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -889,7 +889,7 @@ namespace DirectX // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -907,7 +907,7 @@ namespace DirectX // Aligned & packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -928,7 +928,7 @@ namespace DirectX // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -951,16 +951,16 @@ namespace DirectX // Scattered input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); + __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; __m128 FV = _mm_blend_ps(FV1, FV2, 0x2); @@ -979,16 +979,16 @@ namespace DirectX // Scattered input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); + __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; __m128 FV = _mm_blend_ps(FV1, FV2, 0x2); @@ -1012,7 +1012,7 @@ namespace DirectX for (; i < FloatCount; ++i) { - *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); + *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); pFloat += InputStride; pHalf += OutputStride; } @@ -1027,7 +1027,7 @@ namespace DirectX inline XMVECTOR XM_CALLCONV XMLoadHalf2(_In_ const PackedVector::XMHALF2* pSource) { assert(pSource); - __m128 V = _mm_load_ss(reinterpret_cast(pSource)); + __m128 V = _mm_load_ss(reinterpret_cast(pSource)); return _mm_cvtph_ps(_mm_castps_si128(V)); } @@ -1045,7 +1045,7 @@ namespace DirectX inline XMVECTOR XM_CALLCONV XMLoadHalf4(_In_ const PackedVector::XMHALF4* pSource) { assert(pSource); - __m128i V = _mm_loadl_epi64(reinterpret_cast(pSource)); + __m128i V = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pSource)); return _mm_cvtph_ps(V); } diff --git a/Extensions/DirectXMathBE.h b/Extensions/DirectXMathBE.h index 37ea2c0..b9d93f9 100644 --- a/Extensions/DirectXMathBE.h +++ b/Extensions/DirectXMathBE.h @@ -27,8 +27,8 @@ namespace DirectX tbl.val[0] = vreinterpret_u8_f32(vget_low_f32(V)); tbl.val[1] = vreinterpret_u8_f32(vget_high_f32(V)); - const uint8x8_t rL = vtbl2_u8(tbl, vget_low_u32(idx)); - const uint8x8_t rH = vtbl2_u8(tbl, vget_high_u32(idx)); + uint8x8_t const rL = vtbl2_u8(tbl, vget_low_u32(idx)); + uint8x8_t const rH = vtbl2_u8(tbl, vget_high_u32(idx)); return vcombine_f32(vreinterpret_f32_u8(rL), vreinterpret_f32_u8(rH)); #else XMVECTORU32 E; diff --git a/Extensions/DirectXMathF16C.h b/Extensions/DirectXMathF16C.h index 04cc665..0a36890 100644 --- a/Extensions/DirectXMathF16C.h +++ b/Extensions/DirectXMathF16C.h @@ -80,7 +80,7 @@ namespace DirectX assert(InputStride >= sizeof(HALF)); assert(OutputStride >= sizeof(float)); - auto pHalf = reinterpret_cast(pInputStream); + auto pHalf = reinterpret_cast(pInputStream); auto pFloat = reinterpret_cast(pOutputStream); size_t i = 0; @@ -96,7 +96,7 @@ namespace DirectX // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -111,7 +111,7 @@ namespace DirectX // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -127,7 +127,7 @@ namespace DirectX // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -258,7 +258,7 @@ namespace DirectX assert(InputStride >= sizeof(float)); assert(OutputStride >= sizeof(HALF)); - auto pFloat = reinterpret_cast(pInputStream); + auto pFloat = reinterpret_cast(pInputStream); auto pHalf = reinterpret_cast(pOutputStream); size_t i = 0; @@ -274,7 +274,7 @@ namespace DirectX // Aligned and packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -289,7 +289,7 @@ namespace DirectX // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -307,7 +307,7 @@ namespace DirectX // Aligned & packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -328,7 +328,7 @@ namespace DirectX // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, 0); @@ -351,16 +351,16 @@ namespace DirectX // Scattered input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); + __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; __m128 FV = _mm_blend_ps(FV1, FV2, 0x2); @@ -379,16 +379,16 @@ namespace DirectX // Scattered input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); + __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; __m128 FV = _mm_blend_ps(FV1, FV2, 0x2); @@ -412,7 +412,7 @@ namespace DirectX for (; i < FloatCount; ++i) { - *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); + *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); pFloat += InputStride; pHalf += OutputStride; } @@ -427,7 +427,7 @@ namespace DirectX inline XMVECTOR XM_CALLCONV XMLoadHalf2(_In_ const PackedVector::XMHALF2* pSource) { assert(pSource); - __m128 V = _mm_load_ss(reinterpret_cast(pSource)); + __m128 V = _mm_load_ss(reinterpret_cast(pSource)); return _mm_cvtph_ps(_mm_castps_si128(V)); } @@ -445,7 +445,7 @@ namespace DirectX inline XMVECTOR XM_CALLCONV XMLoadHalf4(_In_ const PackedVector::XMHALF4* pSource) { assert(pSource); - __m128i V = _mm_loadl_epi64(reinterpret_cast(pSource)); + __m128i V = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pSource)); return _mm_cvtph_ps(V); } diff --git a/Extensions/DirectXMathFMA3.h b/Extensions/DirectXMathFMA3.h index f64d953..aa7558f 100644 --- a/Extensions/DirectXMathFMA3.h +++ b/Extensions/DirectXMathFMA3.h @@ -146,8 +146,8 @@ namespace DirectX CXMMATRIX View, CXMMATRIX World) { - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMVECTOR Scale = XMVectorSet(HalfViewportWidth, -HalfViewportHeight, ViewportMaxZ - ViewportMinZ, 0.0f); XMVECTOR Offset = XMVectorSet(ViewportX + HalfViewportWidth, ViewportY + HalfViewportHeight, ViewportMinZ, 0.0f); diff --git a/Extensions/DirectXMathFMA4.h b/Extensions/DirectXMathFMA4.h index 7316871..77ef424 100644 --- a/Extensions/DirectXMathFMA4.h +++ b/Extensions/DirectXMathFMA4.h @@ -170,8 +170,8 @@ namespace DirectX CXMMATRIX View, CXMMATRIX World) { - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMVECTOR Scale = XMVectorSet(HalfViewportWidth, -HalfViewportHeight, ViewportMaxZ - ViewportMinZ, 0.0f); XMVECTOR Offset = XMVectorSet(ViewportX + HalfViewportWidth, ViewportY + HalfViewportHeight, ViewportMinZ, 0.0f); diff --git a/Inc/DirectXCollision.h b/Inc/DirectXCollision.h index bd72a3c..4febde1 100644 --- a/Inc/DirectXCollision.h +++ b/Inc/DirectXCollision.h @@ -53,8 +53,8 @@ namespace DirectX Radius(1.f) {} - BoundingSphere(const BoundingSphere&) = default; - BoundingSphere& operator=(const BoundingSphere&) = default; + BoundingSphere(BoundingSphere const&) = default; + BoundingSphere& operator=(BoundingSphere const&) = default; BoundingSphere(BoundingSphere&&) = default; BoundingSphere& operator=(BoundingSphere&&) = default; @@ -131,8 +131,8 @@ namespace DirectX Extents(1.f, 1.f, 1.f) {} - BoundingBox(const BoundingBox&) = default; - BoundingBox& operator=(const BoundingBox&) = default; + BoundingBox(BoundingBox const&) = default; + BoundingBox& operator=(BoundingBox const&) = default; BoundingBox(BoundingBox&&) = default; BoundingBox& operator=(BoundingBox&&) = default; @@ -211,8 +211,8 @@ namespace DirectX Orientation(0, 0, 0, 1.f) {} - BoundingOrientedBox(const BoundingOrientedBox&) = default; - BoundingOrientedBox& operator=(const BoundingOrientedBox&) = default; + BoundingOrientedBox(BoundingOrientedBox const&) = default; + BoundingOrientedBox& operator=(BoundingOrientedBox const&) = default; BoundingOrientedBox(BoundingOrientedBox&&) = default; BoundingOrientedBox& operator=(BoundingOrientedBox&&) = default; @@ -299,8 +299,8 @@ namespace DirectX Far(1.f) {} - BoundingFrustum(const BoundingFrustum&) = default; - BoundingFrustum& operator=(const BoundingFrustum&) = default; + BoundingFrustum(BoundingFrustum const&) = default; + BoundingFrustum& operator=(BoundingFrustum const&) = default; BoundingFrustum(BoundingFrustum&&) = default; BoundingFrustum& operator=(BoundingFrustum&&) = default; diff --git a/Inc/DirectXCollision.inl b/Inc/DirectXCollision.inl index 1d6f2d3..fa51436 100644 --- a/Inc/DirectXCollision.inl +++ b/Inc/DirectXCollision.inl @@ -643,7 +643,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingSphere::Contai //----------------------------------------------------------------------------- // Sphere in sphere test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(BoundingSphere const& sh) const noexcept { XMVECTOR Center1 = XMLoadFloat3(&Center); float r1 = Radius; @@ -663,7 +663,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const Bou //----------------------------------------------------------------------------- // Axis-aligned box in sphere test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(BoundingBox const& box) const noexcept { if (!box.Intersects(*this)) return DISJOINT; @@ -692,7 +692,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const Bou //----------------------------------------------------------------------------- // Oriented box in sphere test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(BoundingOrientedBox const& box) const noexcept { if (!box.Intersects(*this)) return DISJOINT; @@ -722,7 +722,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const Bou //----------------------------------------------------------------------------- // Frustum in sphere test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(BoundingFrustum const& fr) const noexcept { if (!fr.Intersects(*this)) return DISJOINT; @@ -768,7 +768,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingSphere::Contains(const Bou //----------------------------------------------------------------------------- // Sphere vs. sphere test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingSphere::Intersects(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline bool BoundingSphere::Intersects(BoundingSphere const& sh) const noexcept { // Load A. XMVECTOR vCenterA = XMLoadFloat3(&Center); @@ -792,12 +792,12 @@ _Use_decl_annotations_ inline bool BoundingSphere::Intersects(const BoundingSphe //----------------------------------------------------------------------------- // Box vs. sphere test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingSphere::Intersects(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingSphere::Intersects(BoundingBox const& box) const noexcept { return box.Intersects(*this); } -_Use_decl_annotations_ inline bool BoundingSphere::Intersects(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingSphere::Intersects(BoundingOrientedBox const& box) const noexcept { return box.Intersects(*this); } @@ -805,7 +805,7 @@ _Use_decl_annotations_ inline bool BoundingSphere::Intersects(const BoundingOrie //----------------------------------------------------------------------------- // Frustum vs. sphere test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingSphere::Intersects(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline bool BoundingSphere::Intersects(BoundingFrustum const& fr) const noexcept { return fr.Intersects(*this); } @@ -1009,7 +1009,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingSphere::Contai // Creates a bounding sphere that contains two other bounding spheres //----------------------------------------------------------------------------- _Use_decl_annotations_ inline void -BoundingSphere::CreateMerged(BoundingSphere& Out, const BoundingSphere& S1, const BoundingSphere& S2) noexcept +BoundingSphere::CreateMerged(BoundingSphere& Out, BoundingSphere const& S1, BoundingSphere const& S2) noexcept { XMVECTOR Center1 = XMLoadFloat3(&S1.Center); float r1 = S1.Radius; @@ -1052,14 +1052,14 @@ BoundingSphere::CreateMerged(BoundingSphere& Out, const BoundingSphere& S1, cons //----------------------------------------------------------------------------- // Create sphere enscribing bounding box //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline void BoundingSphere::CreateFromBoundingBox(BoundingSphere& Out, const BoundingBox& box) noexcept +_Use_decl_annotations_ inline void BoundingSphere::CreateFromBoundingBox(BoundingSphere& Out, BoundingBox const& box) noexcept { Out.Center = box.Center; XMVECTOR vExtents = XMLoadFloat3(&box.Extents); Out.Radius = XMVectorGetX(XMVector3Length(vExtents)); } -_Use_decl_annotations_ inline void BoundingSphere::CreateFromBoundingBox(BoundingSphere& Out, const BoundingOrientedBox& box) noexcept +_Use_decl_annotations_ inline void BoundingSphere::CreateFromBoundingBox(BoundingSphere& Out, BoundingOrientedBox const& box) noexcept { // Bounding box orientation is irrelevant because a sphere is rotationally invariant Out.Center = box.Center; @@ -1087,7 +1087,7 @@ BoundingSphere::CreateFromPoints(BoundingSphere& Out, size_t Count, const XMFLOA for (size_t i = 1; i < Count; ++i) { - XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); + XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); float px = XMVectorGetX(Point); float py = XMVectorGetY(Point); @@ -1159,7 +1159,7 @@ BoundingSphere::CreateFromPoints(BoundingSphere& Out, size_t Count, const XMFLOA // Add any points not inside the sphere. for (size_t i = 0; i < Count; ++i) { - XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); + XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); XMVECTOR Delta = XMVectorSubtract(Point, vCenter); @@ -1181,7 +1181,7 @@ BoundingSphere::CreateFromPoints(BoundingSphere& Out, size_t Count, const XMFLOA //----------------------------------------------------------------------------- // Create sphere containing frustum //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline void BoundingSphere::CreateFromFrustum(BoundingSphere& Out, const BoundingFrustum& fr) noexcept +_Use_decl_annotations_ inline void BoundingSphere::CreateFromFrustum(BoundingSphere& Out, BoundingFrustum const& fr) noexcept { XMFLOAT3 Corners[BoundingFrustum::CORNER_COUNT]; fr.GetCorners(Corners); @@ -1313,7 +1313,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingBox::Contains( //----------------------------------------------------------------------------- // Sphere in axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(BoundingSphere const& sh) const noexcept { XMVECTOR SphereCenter = XMLoadFloat3(&sh.Center); XMVECTOR SphereRadius = XMVectorReplicatePtr(&sh.Radius); @@ -1358,7 +1358,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const Boundi //----------------------------------------------------------------------------- // Axis-aligned box in axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(BoundingBox const& box) const noexcept { XMVECTOR CenterA = XMLoadFloat3(&Center); XMVECTOR ExtentsA = XMLoadFloat3(&Extents); @@ -1387,7 +1387,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const Boundi //----------------------------------------------------------------------------- // Oriented box in axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(BoundingOrientedBox const& box) const noexcept { if (!box.Intersects(*this)) return DISJOINT; @@ -1418,7 +1418,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const Boundi //----------------------------------------------------------------------------- // Frustum in axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(BoundingFrustum const& fr) const noexcept { if (!fr.Intersects(*this)) return DISJOINT; @@ -1444,7 +1444,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingBox::Contains(const Boundi //----------------------------------------------------------------------------- // Sphere vs axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline bool BoundingBox::Intersects(BoundingSphere const& sh) const noexcept { XMVECTOR SphereCenter = XMLoadFloat3(&sh.Center); XMVECTOR SphereRadius = XMVectorReplicatePtr(&sh.Radius); @@ -1482,7 +1482,7 @@ _Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingSphere& //----------------------------------------------------------------------------- // Axis-aligned box vs. axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingBox::Intersects(BoundingBox const& box) const noexcept { XMVECTOR CenterA = XMLoadFloat3(&Center); XMVECTOR ExtentsA = XMLoadFloat3(&Extents); @@ -1505,7 +1505,7 @@ _Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingBox& bo //----------------------------------------------------------------------------- // Oriented box vs. axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingBox::Intersects(BoundingOrientedBox const& box) const noexcept { return box.Intersects(*this); } @@ -1513,7 +1513,7 @@ _Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingOriente //----------------------------------------------------------------------------- // Frustum vs. axis-aligned box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingBox::Intersects(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline bool BoundingBox::Intersects(BoundingFrustum const& fr) const noexcept { return fr.Intersects(*this); } @@ -1832,7 +1832,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingBox::Contained //----------------------------------------------------------------------------- // Create axis-aligned box that contains two other bounding boxes //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline void BoundingBox::CreateMerged(BoundingBox& Out, const BoundingBox& b1, const BoundingBox& b2) noexcept +_Use_decl_annotations_ inline void BoundingBox::CreateMerged(BoundingBox& Out, BoundingBox const& b1, BoundingBox const& b2) noexcept { XMVECTOR b1Center = XMLoadFloat3(&b1.Center); XMVECTOR b1Extents = XMLoadFloat3(&b1.Extents); @@ -1855,7 +1855,7 @@ _Use_decl_annotations_ inline void BoundingBox::CreateMerged(BoundingBox& Out, c //----------------------------------------------------------------------------- // Create axis-aligned box that contains a bounding sphere //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline void BoundingBox::CreateFromSphere(BoundingBox& Out, const BoundingSphere& sh) noexcept +_Use_decl_annotations_ inline void BoundingBox::CreateFromSphere(BoundingBox& Out, BoundingSphere const& sh) noexcept { XMVECTOR spCenter = XMLoadFloat3(&sh.Center); XMVECTOR shRadius = XMVectorReplicatePtr(&sh.Radius); @@ -1898,7 +1898,7 @@ BoundingBox::CreateFromPoints(BoundingBox& Out, size_t Count, const XMFLOAT3* pP for (size_t i = 1; i < Count; ++i) { - XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); + XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); vMin = XMVectorMin(vMin, Point); vMax = XMVectorMax(vMax, Point); @@ -2047,7 +2047,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingOrientedBox::C //----------------------------------------------------------------------------- // Sphere in oriented bounding box //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(BoundingSphere const& sh) const noexcept { XMVECTOR SphereCenter = XMLoadFloat3(&sh.Center); XMVECTOR SphereRadius = XMVectorReplicatePtr(&sh.Radius); @@ -2099,7 +2099,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(cons // Axis aligned box vs. oriented box. Constructs an oriented box and uses // the oriented box vs. oriented box test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(BoundingBox const& box) const noexcept { // Make the axis aligned box oriented and do an OBB vs OBB test. BoundingOrientedBox obox(box.Center, box.Extents, XMFLOAT4(0.f, 0.f, 0.f, 1.f)); @@ -2109,7 +2109,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(cons //----------------------------------------------------------------------------- // Oriented bounding box in oriented bounding box //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(BoundingOrientedBox const& box) const noexcept { if (!Intersects(box)) return DISJOINT; @@ -2147,7 +2147,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(cons //----------------------------------------------------------------------------- // Frustum in oriented bounding box //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(BoundingFrustum const& fr) const noexcept { if (!fr.Intersects(*this)) return DISJOINT; @@ -2176,7 +2176,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingOrientedBox::Contains(cons //----------------------------------------------------------------------------- // Sphere vs. oriented box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(BoundingSphere const& sh) const noexcept { XMVECTOR SphereCenter = XMLoadFloat3(&sh.Center); XMVECTOR SphereRadius = XMVectorReplicatePtr(&sh.Radius); @@ -2220,7 +2220,7 @@ _Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const Boundin // Axis aligned box vs. oriented box. Constructs an oriented box and uses // the oriented box vs. oriented box test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(BoundingBox const& box) const noexcept { // Make the axis aligned box oriented and do an OBB vs OBB test. BoundingOrientedBox obox(box.Center, box.Extents, XMFLOAT4(0.f, 0.f, 0.f, 1.f)); @@ -2231,7 +2231,7 @@ _Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const Boundin // Fast oriented box / oriented box intersection test using the separating axis // theorem. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(BoundingOrientedBox const& box) const noexcept { // Build the 3x3 rotation matrix that defines the orientation of B relative to A. XMVECTOR A_quat = XMLoadFloat4(&Orientation); @@ -2420,7 +2420,7 @@ _Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const Boundin //----------------------------------------------------------------------------- // Frustum vs. oriented box test //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline bool BoundingOrientedBox::Intersects(BoundingFrustum const& fr) const noexcept { return fr.Intersects(*this); } @@ -2622,7 +2622,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingOrientedBox::C //----------------------------------------------------------------------------- // Create oriented bounding box from axis-aligned bounding box //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline void BoundingOrientedBox::CreateFromBoundingBox(BoundingOrientedBox& Out, const BoundingBox& box) noexcept +_Use_decl_annotations_ inline void BoundingOrientedBox::CreateFromBoundingBox(BoundingOrientedBox& Out, BoundingBox const& box) noexcept { Out.Center = box.Center; Out.Extents = box.Extents; @@ -2651,7 +2651,7 @@ BoundingOrientedBox::CreateFromPoints(BoundingOrientedBox& Out, size_t Count, co // Compute the center of mass and inertia tensor of the points. for (size_t i = 0; i < Count; ++i) { - XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); + XMVECTOR Point = XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)); CenterOfMass = XMVectorAdd(CenterOfMass, Point); } @@ -2667,7 +2667,7 @@ BoundingOrientedBox::CreateFromPoints(BoundingOrientedBox& Out, size_t Count, co for (size_t i = 0; i < Count; ++i) { XMVECTOR Point - = XMVectorSubtract(XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)), + = XMVectorSubtract(XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)), CenterOfMass); XX_YY_ZZ = XMVectorAdd(XX_YY_ZZ, XMVectorMultiply(Point, Point)); @@ -2732,7 +2732,7 @@ BoundingOrientedBox::CreateFromPoints(BoundingOrientedBox& Out, size_t Count, co for (size_t i = 1; i < Count; ++i) { XMVECTOR Point = XMVector3TransformNormal( - XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)), + XMLoadFloat3(reinterpret_cast(reinterpret_cast(pPoints) + i * Stride)), InverseR); vMin = XMVectorMin(vMin, Point); @@ -2961,7 +2961,7 @@ _Use_decl_annotations_ inline ContainmentType XM_CALLCONV BoundingFrustum::Conta } //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(BoundingSphere const& sh) const noexcept { // Load origin and orientation of the frustum. XMVECTOR vOrigin = XMLoadFloat3(&Origin); @@ -2996,7 +2996,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const Bo } //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(BoundingBox const& box) const noexcept { // Load origin and orientation of the frustum. XMVECTOR vOrigin = XMLoadFloat3(&Origin); @@ -3031,7 +3031,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const Bo } //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(BoundingOrientedBox const& box) const noexcept { // Load origin and orientation of the frustum. XMVECTOR vOrigin = XMLoadFloat3(&Origin); @@ -3066,7 +3066,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const Bo } //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(BoundingFrustum const& fr) const noexcept { // Load origin and orientation of the frustum. XMVECTOR vOrigin = XMLoadFloat3(&Origin); @@ -3107,7 +3107,7 @@ _Use_decl_annotations_ inline ContainmentType BoundingFrustum::Contains(const Bo // sphere and compares the distance to the nearest feature to the radius of the // sphere //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingSphere& sh) const noexcept +_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(BoundingSphere const& sh) const noexcept { XMVECTOR Zero = XMVectorZero(); @@ -3181,7 +3181,7 @@ _Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingSph // to the sphere. // The faces adjacent to each face are: - static const size_t adjacent_faces[6][4] = { { 2, 3, 4, 5 }, // 0 + static size_t const adjacent_faces[6][4] = { { 2, 3, 4, 5 }, // 0 { 2, 3, 4, 5 }, // 1 { 0, 1, 4, 5 }, // 2 { 0, 1, 4, 5 }, // 3 @@ -3237,7 +3237,7 @@ _Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingSph Corners[7] = XMVectorMultiply(vLeftBottom, vFar); // The Edges are: - static const size_t edges[12][2] = { + static size_t const edges[12][2] = { // clang-format off { 0, 1 }, { 2, 3 }, { 0, 2 }, { 1, 3 }, // Near plane { 4, 5 }, { 6, 7 }, { 4, 6 }, { 5, 7 }, // Far plane @@ -3277,7 +3277,7 @@ _Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingSph // Exact axis aligned box vs frustum test. Constructs an oriented box and uses // the oriented box vs frustum test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(BoundingBox const& box) const noexcept { // Make the axis aligned box oriented and do an OBB vs frustum test. BoundingOrientedBox obox(box.Center, box.Extents, XMFLOAT4(0.f, 0.f, 0.f, 1.f)); @@ -3287,7 +3287,7 @@ _Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingBox //----------------------------------------------------------------------------- // Exact oriented box vs frustum test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingOrientedBox& box) const noexcept +_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(BoundingOrientedBox const& box) const noexcept { static const XMVECTORU32 SelectY = { { { XM_SELECT_0, XM_SELECT_1, XM_SELECT_0, XM_SELECT_0 } } }; static const XMVECTORU32 SelectZ = { { { XM_SELECT_0, XM_SELECT_0, XM_SELECT_1, XM_SELECT_0 } } }; @@ -3476,7 +3476,7 @@ _Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingOri //----------------------------------------------------------------------------- // Exact frustum vs frustum test. //----------------------------------------------------------------------------- -_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(const BoundingFrustum& fr) const noexcept +_Use_decl_annotations_ inline bool BoundingFrustum::Intersects(BoundingFrustum const& fr) const noexcept { // Load origin and orientation of frustum B. XMVECTOR OriginB = XMLoadFloat3(&Origin); diff --git a/Inc/DirectXMath.h b/Inc/DirectXMath.h index a7eb137..10dc11d 100644 --- a/Inc/DirectXMath.h +++ b/Inc/DirectXMath.h @@ -448,7 +448,7 @@ namespace DirectX { return v; } - inline operator const float*() const noexcept + inline operator float const*() const noexcept { return f; } @@ -3100,7 +3100,7 @@ namespace DirectX // Splat the scalar value (It's really a float) vScale = vreinterpretq_s32_u32(vdupq_n_u32(uScale)); // Multiply by the reciprocal (Perform a right shift by DivExponent) - vResult = vmulq_f32(vResult, reinterpret_cast(&vScale)[0]); + vResult = vmulq_f32(vResult, reinterpret_cast(&vScale)[0]); return vResult; #else // XM_SSE_INTRINSICS_ // Splat the int diff --git a/Inc/DirectXMathConvert.inl b/Inc/DirectXMathConvert.inl index 59d4b7c..7778f96 100644 --- a/Inc/DirectXMathConvert.inl +++ b/Inc/DirectXMathConvert.inl @@ -221,7 +221,7 @@ inline XMVECTOR XM_CALLCONV XMConvertVectorFloatToUInt(FXMVECTOR VFloat, uint32_ ****************************************************************************/ //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt(uint32_t const* pSource) noexcept { assert(pSource); #if defined(_XM_NO_INTRINSICS_) @@ -235,12 +235,12 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt(const uint32_t* pSo uint32x4_t zero = vdupq_n_u32(0); return vreinterpretq_f32_u32(vld1q_lane_u32(pSource, zero, 0)); #elif defined(_XM_SSE_INTRINSICS_) - return _mm_load_ss(reinterpret_cast(pSource)); + return _mm_load_ss(reinterpret_cast(pSource)); #endif } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat(const float* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat(float const* pSource) noexcept { assert(pSource); #if defined(_XM_NO_INTRINSICS_) @@ -259,7 +259,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat(const float* pSou } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt2(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt2(uint32_t const* pSource) noexcept { assert(pSource); #if defined(_XM_NO_INTRINSICS_) @@ -274,12 +274,12 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt2(const uint32_t* pS uint32x2_t zero = vdup_n_u32(0); return vreinterpretq_f32_u32(vcombine_u32(x, zero)); #elif defined(_XM_SSE_INTRINSICS_) - return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); #endif } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt2A(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt2A(uint32_t const* pSource) noexcept { assert(pSource); assert((reinterpret_cast(pSource) & 0xF) == 0); @@ -299,7 +299,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt2A(const uint32_t* p uint32x2_t zero = vdup_n_u32(0); return vreinterpretq_f32_u32(vcombine_u32(x, zero)); #elif defined(_XM_SSE_INTRINSICS_) - return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); #endif } @@ -315,11 +315,11 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat2(const XMFLOAT2* V.vector4_f32[3] = 0.f; return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - float32x2_t x = vld1_f32(reinterpret_cast(pSource)); + float32x2_t x = vld1_f32(reinterpret_cast(pSource)); float32x2_t zero = vdup_n_f32(0); return vcombine_f32(x, zero); #elif defined(_XM_SSE_INTRINSICS_) - return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); #endif } @@ -337,14 +337,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat2A(const XMFLOAT2A return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) #if defined(_MSC_VER) && !defined(__clang__) && !defined(_ARM64_DISTINCT_NEON_TYPES) - float32x2_t x = vld1_f32_ex(reinterpret_cast(pSource), 64); + float32x2_t x = vld1_f32_ex(reinterpret_cast(pSource), 64); #else - float32x2_t x = vld1_f32(reinterpret_cast(pSource)); + float32x2_t x = vld1_f32(reinterpret_cast(pSource)); #endif float32x2_t zero = vdup_n_f32(0); return vcombine_f32(x, zero); #elif defined(_XM_SSE_INTRINSICS_) - return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + return _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); #endif } @@ -360,12 +360,12 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadSInt2(const XMINT2* pSo V.vector4_f32[3] = 0.f; return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - int32x2_t x = vld1_s32(reinterpret_cast(pSource)); + int32x2_t x = vld1_s32(reinterpret_cast(pSource)); float32x2_t v = vcvt_f32_s32(x); float32x2_t zero = vdup_n_f32(0); return vcombine_f32(v, zero); #elif defined(_XM_SSE_INTRINSICS_) - __m128 V = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 V = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); return _mm_cvtepi32_ps(_mm_castps_si128(V)); #endif } @@ -382,12 +382,12 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUInt2(const XMUINT2* pS V.vector4_f32[3] = 0.f; return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t x = vld1_u32(reinterpret_cast(pSource)); + uint32x2_t x = vld1_u32(reinterpret_cast(pSource)); float32x2_t v = vcvt_f32_u32(x); float32x2_t zero = vdup_n_f32(0); return vcombine_f32(v, zero); #elif defined(_XM_SSE_INTRINSICS_) - __m128 V = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 V = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); // For the values that are higher than 0x7FFFFFFF, a fixup is needed // Determine which ones need the fix. XMVECTOR vMask = _mm_and_ps(V, g_XMNegativeZero); @@ -405,7 +405,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUInt2(const XMUINT2* pS } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt3(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt3(uint32_t const* pSource) noexcept { assert(pSource); #if defined(_XM_NO_INTRINSICS_) @@ -421,18 +421,18 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt3(const uint32_t* pS uint32x2_t y = vld1_lane_u32(pSource + 2, zero, 0); return vreinterpretq_f32_u32(vcombine_u32(x, y)); #elif defined(_XM_SSE4_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); - __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); return _mm_insert_ps(xy, z, 0x20); #elif defined(_XM_SSE_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); - __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); return _mm_movelh_ps(xy, z); #endif } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt3A(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt3A(uint32_t const* pSource) noexcept { assert(pSource); assert((reinterpret_cast(pSource) & 0xF) == 0); @@ -452,12 +452,12 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt3A(const uint32_t* p #endif return vreinterpretq_f32_u32(vsetq_lane_u32(0, V, 3)); #elif defined(_XM_SSE4_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); - __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); return _mm_insert_ps(xy, z, 0x20); #elif defined(_XM_SSE_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); - __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 z = _mm_load_ss(reinterpret_cast(pSource + 2)); return _mm_movelh_ps(xy, z); #endif } @@ -474,16 +474,16 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat3(const XMFLOAT3* V.vector4_f32[3] = 0.f; return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - float32x2_t x = vld1_f32(reinterpret_cast(pSource)); + float32x2_t x = vld1_f32(reinterpret_cast(pSource)); float32x2_t zero = vdup_n_f32(0); - float32x2_t y = vld1_lane_f32(reinterpret_cast(pSource) + 2, zero, 0); + float32x2_t y = vld1_lane_f32(reinterpret_cast(pSource) + 2, zero, 0); return vcombine_f32(x, y); #elif defined(_XM_SSE4_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); __m128 z = _mm_load_ss(&pSource->z); return _mm_insert_ps(xy, z, 0x20); #elif defined(_XM_SSE_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); __m128 z = _mm_load_ss(&pSource->z); return _mm_movelh_ps(xy, z); #endif @@ -504,9 +504,9 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat3A(const XMFLOAT3A #elif defined(_XM_ARM_NEON_INTRINSICS_) // Reads an extra float which is zero'd #if defined(_MSC_VER) && !defined(__clang__) && !defined(_ARM64_DISTINCT_NEON_TYPES) - float32x4_t V = vld1q_f32_ex(reinterpret_cast(pSource), 128); + float32x4_t V = vld1q_f32_ex(reinterpret_cast(pSource), 128); #else - float32x4_t V = vld1q_f32(reinterpret_cast(pSource)); + float32x4_t V = vld1q_f32(reinterpret_cast(pSource)); #endif return vsetq_lane_f32(0, V, 3); #elif defined(_XM_SSE4_INTRINSICS_) @@ -534,14 +534,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadSInt3(const XMINT3* pSo return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - int32x2_t x = vld1_s32(reinterpret_cast(pSource)); + int32x2_t x = vld1_s32(reinterpret_cast(pSource)); int32x2_t zero = vdup_n_s32(0); - int32x2_t y = vld1_lane_s32(reinterpret_cast(pSource) + 2, zero, 0); + int32x2_t y = vld1_lane_s32(reinterpret_cast(pSource) + 2, zero, 0); int32x4_t v = vcombine_s32(x, y); return vcvtq_f32_s32(v); #elif defined(_XM_SSE_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); - __m128 z = _mm_load_ss(reinterpret_cast(&pSource->z)); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 z = _mm_load_ss(reinterpret_cast(&pSource->z)); __m128 V = _mm_movelh_ps(xy, z); return _mm_cvtepi32_ps(_mm_castps_si128(V)); #endif @@ -559,14 +559,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUInt3(const XMUINT3* pS V.vector4_f32[3] = 0.f; return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t x = vld1_u32(reinterpret_cast(pSource)); + uint32x2_t x = vld1_u32(reinterpret_cast(pSource)); uint32x2_t zero = vdup_n_u32(0); - uint32x2_t y = vld1_lane_u32(reinterpret_cast(pSource) + 2, zero, 0); + uint32x2_t y = vld1_lane_u32(reinterpret_cast(pSource) + 2, zero, 0); uint32x4_t v = vcombine_u32(x, y); return vcvtq_f32_u32(v); #elif defined(_XM_SSE_INTRINSICS_) - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); - __m128 z = _mm_load_ss(reinterpret_cast(&pSource->z)); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pSource))); + __m128 z = _mm_load_ss(reinterpret_cast(&pSource->z)); __m128 V = _mm_movelh_ps(xy, z); // For the values that are higher than 0x7FFFFFFF, a fixup is needed // Determine which ones need the fix. @@ -585,7 +585,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUInt3(const XMUINT3* pS } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt4(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt4(uint32_t const* pSource) noexcept { assert(pSource); @@ -599,13 +599,13 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt4(const uint32_t* pS #elif defined(_XM_ARM_NEON_INTRINSICS_) return vreinterpretq_f32_u32(vld1q_u32(pSource)); #elif defined(_XM_SSE_INTRINSICS_) - __m128i V = _mm_loadu_si128(reinterpret_cast(pSource)); + __m128i V = _mm_loadu_si128(reinterpret_cast<__m128i const*>(pSource)); return _mm_castsi128_ps(V); #endif } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt4A(const uint32_t* pSource) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt4A(uint32_t const* pSource) noexcept { assert(pSource); assert((reinterpret_cast(pSource) & 0xF) == 0); @@ -623,7 +623,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadInt4A(const uint32_t* p return vreinterpretq_f32_u32(vld1q_u32(pSource)); #endif #elif defined(_XM_SSE_INTRINSICS_) - __m128i V = _mm_load_si128(reinterpret_cast(pSource)); + __m128i V = _mm_load_si128(reinterpret_cast<__m128i const*>(pSource)); return _mm_castsi128_ps(V); #endif } @@ -640,7 +640,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat4(const XMFLOAT4* V.vector4_f32[3] = pSource->w; return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - return vld1q_f32(reinterpret_cast(pSource)); + return vld1q_f32(reinterpret_cast(pSource)); #elif defined(_XM_SSE_INTRINSICS_) return _mm_loadu_ps(&pSource->x); #endif @@ -660,9 +660,9 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadFloat4A(const XMFLOAT4A return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) #if defined(_MSC_VER) && !defined(__clang__) && !defined(_ARM64_DISTINCT_NEON_TYPES) - return vld1q_f32_ex(reinterpret_cast(pSource), 128); + return vld1q_f32_ex(reinterpret_cast(pSource), 128); #else - return vld1q_f32(reinterpret_cast(pSource)); + return vld1q_f32(reinterpret_cast(pSource)); #endif #elif defined(_XM_SSE_INTRINSICS_) return _mm_load_ps(&pSource->x); @@ -683,10 +683,10 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadSInt4(const XMINT4* pSo return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - int32x4_t v = vld1q_s32(reinterpret_cast(pSource)); + int32x4_t v = vld1q_s32(reinterpret_cast(pSource)); return vcvtq_f32_s32(v); #elif defined(_XM_SSE_INTRINSICS_) - __m128i V = _mm_loadu_si128(reinterpret_cast(pSource)); + __m128i V = _mm_loadu_si128(reinterpret_cast<__m128i const*>(pSource)); return _mm_cvtepi32_ps(V); #endif } @@ -703,10 +703,10 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUInt4(const XMUINT4* pS V.vector4_f32[3] = static_cast(pSource->w); return V; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x4_t v = vld1q_u32(reinterpret_cast(pSource)); + uint32x4_t v = vld1q_u32(reinterpret_cast(pSource)); return vcvtq_f32_u32(v); #elif defined(_XM_SSE_INTRINSICS_) - __m128i V = _mm_loadu_si128(reinterpret_cast(pSource)); + __m128i V = _mm_loadu_si128(reinterpret_cast<__m128i const*>(pSource)); // For the values that are higher than 0x7FFFFFFF, a fixup is needed // Determine which ones need the fix. XMVECTOR vMask = _mm_and_ps(_mm_castsi128_ps(V), g_XMNegativeZero); @@ -753,7 +753,7 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMLoadFloat3x3(const XMFLOAT3 #elif defined(_XM_ARM_NEON_INTRINSICS_) float32x4_t v0 = vld1q_f32(&pSource->m[0][0]); float32x4_t v1 = vld1q_f32(&pSource->m[1][1]); - float32x2_t v2 = vcreate_f32(static_cast(*reinterpret_cast(&pSource->m[2][2]))); + float32x2_t v2 = vcreate_f32(static_cast(*reinterpret_cast(&pSource->m[2][2]))); float32x4_t T = vextq_f32(v0, v1, 3); XMMATRIX M; @@ -1141,10 +1141,10 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMLoadFloat4x4(const XMFLOAT4 #elif defined(_XM_ARM_NEON_INTRINSICS_) XMMATRIX M; - M.r[0] = vld1q_f32(reinterpret_cast(&pSource->_11)); - M.r[1] = vld1q_f32(reinterpret_cast(&pSource->_21)); - M.r[2] = vld1q_f32(reinterpret_cast(&pSource->_31)); - M.r[3] = vld1q_f32(reinterpret_cast(&pSource->_41)); + M.r[0] = vld1q_f32(reinterpret_cast(&pSource->_11)); + M.r[1] = vld1q_f32(reinterpret_cast(&pSource->_21)); + M.r[2] = vld1q_f32(reinterpret_cast(&pSource->_31)); + M.r[3] = vld1q_f32(reinterpret_cast(&pSource->_41)); return M; #elif defined(_XM_SSE_INTRINSICS_) XMMATRIX M; @@ -1188,15 +1188,15 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMLoadFloat4x4A(const XMFLOAT #elif defined(_XM_ARM_NEON_INTRINSICS_) XMMATRIX M; #if defined(_MSC_VER) && !defined(__clang__) && !defined(_ARM64_DISTINCT_NEON_TYPES) - M.r[0] = vld1q_f32_ex(reinterpret_cast(&pSource->_11), 128); - M.r[1] = vld1q_f32_ex(reinterpret_cast(&pSource->_21), 128); - M.r[2] = vld1q_f32_ex(reinterpret_cast(&pSource->_31), 128); - M.r[3] = vld1q_f32_ex(reinterpret_cast(&pSource->_41), 128); + M.r[0] = vld1q_f32_ex(reinterpret_cast(&pSource->_11), 128); + M.r[1] = vld1q_f32_ex(reinterpret_cast(&pSource->_21), 128); + M.r[2] = vld1q_f32_ex(reinterpret_cast(&pSource->_31), 128); + M.r[3] = vld1q_f32_ex(reinterpret_cast(&pSource->_41), 128); #else - M.r[0] = vld1q_f32(reinterpret_cast(&pSource->_11)); - M.r[1] = vld1q_f32(reinterpret_cast(&pSource->_21)); - M.r[2] = vld1q_f32(reinterpret_cast(&pSource->_31)); - M.r[3] = vld1q_f32(reinterpret_cast(&pSource->_41)); + M.r[0] = vld1q_f32(reinterpret_cast(&pSource->_11)); + M.r[1] = vld1q_f32(reinterpret_cast(&pSource->_21)); + M.r[2] = vld1q_f32(reinterpret_cast(&pSource->_31)); + M.r[3] = vld1q_f32(reinterpret_cast(&pSource->_41)); #endif return M; #elif defined(_XM_SSE_INTRINSICS_) @@ -1220,7 +1220,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMStoreInt(uint32_t* pDestination #if defined(_XM_NO_INTRINSICS_) *pDestination = XMVectorGetIntX(V); #elif defined(_XM_ARM_NEON_INTRINSICS_) - vst1q_lane_u32(pDestination, *reinterpret_cast(&V), 0); + vst1q_lane_u32(pDestination, *reinterpret_cast(&V), 0); #elif defined(_XM_SSE_INTRINSICS_) _mm_store_ss(reinterpret_cast(pDestination), V); #endif @@ -1379,7 +1379,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMStoreInt3(uint32_t* pDestinatio #elif defined(_XM_ARM_NEON_INTRINSICS_) uint32x2_t VL = vget_low_u32(vreinterpretq_u32_f32(V)); vst1_u32(pDestination, VL); - vst1q_lane_u32(pDestination + 2, *reinterpret_cast(&V), 2); + vst1q_lane_u32(pDestination + 2, *reinterpret_cast(&V), 2); #elif defined(_XM_SSE_INTRINSICS_) _mm_store_sd(reinterpret_cast(pDestination), _mm_castps_pd(V)); __m128 z = XM_PERMUTE_PS(V, _MM_SHUFFLE(2, 2, 2, 2)); @@ -1403,7 +1403,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMStoreInt3A(uint32_t* pDestinati #else vst1_u32(pDestination, VL); #endif - vst1q_lane_u32(pDestination + 2, *reinterpret_cast(&V), 2); + vst1q_lane_u32(pDestination + 2, *reinterpret_cast(&V), 2); #elif defined(_XM_SSE_INTRINSICS_) _mm_store_sd(reinterpret_cast(pDestination), _mm_castps_pd(V)); __m128 z = _mm_movehl_ps(V, V); diff --git a/Inc/DirectXMathMatrix.inl b/Inc/DirectXMathMatrix.inl index 220bf9c..2b2cda3 100644 --- a/Inc/DirectXMathMatrix.inl +++ b/Inc/DirectXMathMatrix.inl @@ -31,7 +31,7 @@ inline bool XM_CALLCONV XMMatrixIsNaN(FXMMATRIX M) noexcept { #if defined(_XM_NO_INTRINSICS_) size_t i = 16; - auto pWork = reinterpret_cast(&M.m[0][0]); + auto pWork = reinterpret_cast(&M.m[0][0]); do { // Fetch value into integer unit @@ -99,7 +99,7 @@ inline bool XM_CALLCONV XMMatrixIsInfinite(FXMMATRIX M) noexcept { #if defined(_XM_NO_INTRINSICS_) size_t i = 16; - auto pWork = reinterpret_cast(&M.m[0][0]); + auto pWork = reinterpret_cast(&M.m[0][0]); do { // Fetch value into integer unit @@ -166,7 +166,7 @@ inline bool XM_CALLCONV XMMatrixIsIdentity(FXMMATRIX M) noexcept { #if defined(_XM_NO_INTRINSICS_) // Use the integer pipeline to reduce branching to a minimum - auto pWork = reinterpret_cast(&M.m[0][0]); + auto pWork = reinterpret_cast(&M.m[0][0]); // Convert 1.0f to zero and or them together uint32_t uOne = pWork[0] ^ 0x3F800000U; // Or all the 0.0f entries together @@ -344,10 +344,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiply(FXMMATRIX M1, CXMMATRIX M2) noexcep XMMATRIX mResult; // Splat the component X,Y,Z then W #if defined(_XM_AVX_INTRINSICS_) - XMVECTOR vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 0); - XMVECTOR vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 1); - XMVECTOR vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 2); - XMVECTOR vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 3); + XMVECTOR vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 0); + XMVECTOR vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 1); + XMVECTOR vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 2); + XMVECTOR vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 3); #else // Use vW to hold the original row XMVECTOR vW = M1.r[0]; @@ -368,10 +368,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiply(FXMMATRIX M1, CXMMATRIX M2) noexcep mResult.r[0] = vX; // Repeat for the other 3 rows #if defined(_XM_AVX_INTRINSICS_) - vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 0); - vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 1); - vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 2); - vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 3); + vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 0); + vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 1); + vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 2); + vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 3); #else vW = M1.r[1]; vX = XM_PERMUTE_PS(vW, _MM_SHUFFLE(0, 0, 0, 0)); @@ -388,10 +388,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiply(FXMMATRIX M1, CXMMATRIX M2) noexcep vX = _mm_add_ps(vX, vY); mResult.r[1] = vX; #if defined(_XM_AVX_INTRINSICS_) - vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 0); - vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 1); - vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 2); - vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 3); + vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 0); + vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 1); + vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 2); + vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 3); #else vW = M1.r[2]; vX = XM_PERMUTE_PS(vW, _MM_SHUFFLE(0, 0, 0, 0)); @@ -408,10 +408,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiply(FXMMATRIX M1, CXMMATRIX M2) noexcep vX = _mm_add_ps(vX, vY); mResult.r[2] = vX; #if defined(_XM_AVX_INTRINSICS_) - vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 0); - vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 1); - vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 2); - vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 3); + vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 0); + vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 1); + vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 2); + vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 3); #else vW = M1.r[3]; vX = XM_PERMUTE_PS(vW, _MM_SHUFFLE(0, 0, 0, 0)); @@ -575,10 +575,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiplyTranspose(FXMMATRIX M1, CXMMATRIX M2 #elif defined(_XM_SSE_INTRINSICS_) // Splat the component X,Y,Z then W #if defined(_XM_AVX_INTRINSICS_) - XMVECTOR vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 0); - XMVECTOR vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 1); - XMVECTOR vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 2); - XMVECTOR vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 3); + XMVECTOR vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 0); + XMVECTOR vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 1); + XMVECTOR vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 2); + XMVECTOR vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[0]) + 3); #else // Use vW to hold the original row XMVECTOR vW = M1.r[0]; @@ -599,10 +599,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiplyTranspose(FXMMATRIX M1, CXMMATRIX M2 XMVECTOR r0 = vX; // Repeat for the other 3 rows #if defined(_XM_AVX_INTRINSICS_) - vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 0); - vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 1); - vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 2); - vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 3); + vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 0); + vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 1); + vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 2); + vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[1]) + 3); #else vW = M1.r[1]; vX = XM_PERMUTE_PS(vW, _MM_SHUFFLE(0, 0, 0, 0)); @@ -619,10 +619,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiplyTranspose(FXMMATRIX M1, CXMMATRIX M2 vX = _mm_add_ps(vX, vY); XMVECTOR r1 = vX; #if defined(_XM_AVX_INTRINSICS_) - vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 0); - vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 1); - vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 2); - vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 3); + vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 0); + vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 1); + vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 2); + vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[2]) + 3); #else vW = M1.r[2]; vX = XM_PERMUTE_PS(vW, _MM_SHUFFLE(0, 0, 0, 0)); @@ -639,10 +639,10 @@ inline XMMATRIX XM_CALLCONV XMMatrixMultiplyTranspose(FXMMATRIX M1, CXMMATRIX M2 vX = _mm_add_ps(vX, vY); XMVECTOR r2 = vX; #if defined(_XM_AVX_INTRINSICS_) - vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 0); - vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 1); - vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 2); - vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 3); + vX = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 0); + vY = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 1); + vZ = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 2); + vW = _mm_broadcast_ss(reinterpret_cast(&M1.r[3]) + 3); #else vW = M1.r[3]; vX = XM_PERMUTE_PS(vW, _MM_SHUFFLE(0, 0, 0, 0)); @@ -993,11 +993,11 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMMatrixInverseTranspose(XMVE // XMMatrixInverse internally transposes M first (MT = M^T), then computes // cofactors of MT to produce adj(M^T) = adj(M)^T. The final transpose requested // by the caller cancels that internal one, so InverseTranspose simply runs the - // same cofactor algorithm directly on M — skipping the initial transpose entirely. + // same cofactor algorithm directly on M - skipping the initial transpose entirely. #if defined(_XM_NO_INTRINSICS_) || defined(_XM_ARM_NEON_INTRINSICS_) - // No initial transpose — use M directly (was MT in XMMatrixInverse) + // No initial transpose - use M directly (was MT in XMMatrixInverse) XMVECTOR V0[4], V1[4]; V0[0] = XMVectorSwizzle(M.r[2]); V1[0] = XMVectorSwizzle(M.r[3]); @@ -1059,13 +1059,13 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMMatrixInverseTranspose(XMVE V1[3] = XMVectorPermute(D1, D2); XMVECTOR C1 = XMVectorNegativeMultiplySubtract(V0[0], V1[0], C0); - C0 = XMVectorMultiplyAdd(V0[0], V1[0], C0); + C0 = XMVectorMultiplyAdd(V0[0], V1[0], C0); XMVECTOR C3 = XMVectorMultiplyAdd(V0[1], V1[1], C2); - C2 = XMVectorNegativeMultiplySubtract(V0[1], V1[1], C2); + C2 = XMVectorNegativeMultiplySubtract(V0[1], V1[1], C2); XMVECTOR C5 = XMVectorNegativeMultiplySubtract(V0[2], V1[2], C4); - C4 = XMVectorMultiplyAdd(V0[2], V1[2], C4); + C4 = XMVectorMultiplyAdd(V0[2], V1[2], C4); XMVECTOR C7 = XMVectorMultiplyAdd(V0[3], V1[3], C6); - C6 = XMVectorNegativeMultiplySubtract(V0[3], V1[3], C6); + C6 = XMVectorNegativeMultiplySubtract(V0[3], V1[3], C6); XMMATRIX R; R.r[0] = XMVectorSelect(C0, C1, g_XMSelect0101.v); @@ -1088,7 +1088,7 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMMatrixInverseTranspose(XMVE return Result; #elif defined(_XM_SSE_INTRINSICS_) - // No initial transpose block — cofactors are computed from M.r directly. + // No initial transpose block - cofactors are computed from M.r directly. // This gives adj(M)/det(M) = (M^-1)^T without any redundant shuffles. XMVECTOR V00 = XM_PERMUTE_PS(M.r[2], _MM_SHUFFLE(1, 1, 0, 0)); @@ -1120,10 +1120,10 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMMatrixInverseTranspose(XMVE V11 = _mm_shuffle_ps(V11, D0, _MM_SHUFFLE(2, 1, 2, 1)); // V13 = D1Y,D1W,D2W,D2W XMVECTOR V13 = _mm_shuffle_ps(D1, D2, _MM_SHUFFLE(3, 3, 3, 1)); - V02 = XM_PERMUTE_PS(M.r[3], _MM_SHUFFLE(1, 0, 2, 1)); - V12 = _mm_shuffle_ps(V13, D1, _MM_SHUFFLE(0, 3, 0, 2)); + V02 = XM_PERMUTE_PS(M.r[3], _MM_SHUFFLE(1, 0, 2, 1)); + V12 = _mm_shuffle_ps(V13, D1, _MM_SHUFFLE(0, 3, 0, 2)); XMVECTOR V03 = XM_PERMUTE_PS(M.r[2], _MM_SHUFFLE(0, 1, 0, 2)); - V13 = _mm_shuffle_ps(V13, D1, _MM_SHUFFLE(2, 1, 2, 1)); + V13 = _mm_shuffle_ps(V13, D1, _MM_SHUFFLE(2, 1, 2, 1)); XMVECTOR C0 = _mm_mul_ps(V00, V10); XMVECTOR C2 = _mm_mul_ps(V01, V11); @@ -1165,18 +1165,18 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMMatrixInverseTranspose(XMVE V13 = _mm_shuffle_ps(D1, D2, _MM_SHUFFLE(3, 2, 3, 0)); V13 = XM_PERMUTE_PS(V13, _MM_SHUFFLE(2, 1, 0, 3)); - V00 = _mm_mul_ps(V00, V10); - V01 = _mm_mul_ps(V01, V11); - V02 = _mm_mul_ps(V02, V12); - V03 = _mm_mul_ps(V03, V13); + V00 = _mm_mul_ps(V00, V10); + V01 = _mm_mul_ps(V01, V11); + V02 = _mm_mul_ps(V02, V12); + V03 = _mm_mul_ps(V03, V13); XMVECTOR C1 = _mm_sub_ps(C0, V00); - C0 = _mm_add_ps(C0, V00); + C0 = _mm_add_ps(C0, V00); XMVECTOR C3 = _mm_add_ps(C2, V01); - C2 = _mm_sub_ps(C2, V01); + C2 = _mm_sub_ps(C2, V01); XMVECTOR C5 = _mm_sub_ps(C4, V02); - C4 = _mm_add_ps(C4, V02); + C4 = _mm_add_ps(C4, V02); XMVECTOR C7 = _mm_add_ps(C6, V03); - C6 = _mm_sub_ps(C6, V03); + C6 = _mm_sub_ps(C6, V03); C0 = _mm_shuffle_ps(C0, C1, _MM_SHUFFLE(3, 1, 2, 0)); C2 = _mm_shuffle_ps(C2, C3, _MM_SHUFFLE(3, 1, 2, 0)); @@ -1186,7 +1186,7 @@ _Use_decl_annotations_ inline XMMATRIX XM_CALLCONV XMMatrixInverseTranspose(XMVE C2 = XM_PERMUTE_PS(C2, _MM_SHUFFLE(3, 1, 2, 0)); C4 = XM_PERMUTE_PS(C4, _MM_SHUFFLE(3, 1, 2, 0)); C6 = XM_PERMUTE_PS(C6, _MM_SHUFFLE(3, 1, 2, 0)); - // Determinant — det(M) == det(M^T), same value as XMMatrixInverse + // Determinant - det(M) == det(M^T), same value as XMMatrixInverse XMVECTOR vTemp = XMVector4Dot(C0, M.r[0]); if (pDeterminant != nullptr) *pDeterminant = vTemp; @@ -1663,7 +1663,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixRotationX(float Angle) noexcept float fCosAngle; XMScalarSinCos(&fSinAngle, &fCosAngle, Angle); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); float32x4_t T1 = vsetq_lane_f32(fCosAngle, Zero, 1); T1 = vsetq_lane_f32(fSinAngle, T1, 2); @@ -1736,7 +1736,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixRotationY(float Angle) noexcept float fCosAngle; XMScalarSinCos(&fSinAngle, &fCosAngle, Angle); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); float32x4_t T0 = vsetq_lane_f32(fCosAngle, Zero, 0); T0 = vsetq_lane_f32(-fSinAngle, T0, 2); @@ -1809,7 +1809,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixRotationZ(float Angle) noexcept float fCosAngle; XMScalarSinCos(&fSinAngle, &fCosAngle, Angle); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); float32x4_t T0 = vsetq_lane_f32(fCosAngle, Zero, 0); T0 = vsetq_lane_f32(fSinAngle, T0, 1); @@ -2445,7 +2445,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveLH(float ViewWidth, float ViewHei #elif defined(_XM_ARM_NEON_INTRINSICS_) float TwoNearZ = NearZ + NearZ; float fRange = FarZ / (FarZ - NearZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(TwoNearZ / ViewWidth, Zero, 0); M.r[1] = vsetq_lane_f32(TwoNearZ / ViewHeight, Zero, 1); @@ -2521,7 +2521,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveRH(float ViewWidth, float ViewHei #elif defined(_XM_ARM_NEON_INTRINSICS_) float TwoNearZ = NearZ + NearZ; float fRange = FarZ / (NearZ - FarZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(TwoNearZ / ViewWidth, Zero, 0); @@ -2608,7 +2608,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH(float FovAngleY, float Aspe float fRange = FarZ / (FarZ - NearZ); float Height = CosFov / SinFov; float Width = Height / AspectRatio; - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(Width, Zero, 0); @@ -2698,7 +2698,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovRH(float FovAngleY, float Aspe float fRange = FarZ / (NearZ - FarZ); float Height = CosFov / SinFov; float Width = Height / AspectRatio; - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(Width, Zero, 0); @@ -2783,7 +2783,7 @@ XMMatrixPerspectiveOffCenterLH(float ViewLeft, float ViewRight, float ViewBottom float ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); float ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); float fRange = FarZ / (FarZ - NearZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(TwoNearZ * ReciprocalWidth, Zero, 0); @@ -2863,7 +2863,7 @@ XMMatrixPerspectiveOffCenterRH(float ViewLeft, float ViewRight, float ViewBottom float ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); float ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); float fRange = FarZ / (NearZ - FarZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(TwoNearZ * ReciprocalWidth, Zero, 0); @@ -2936,7 +2936,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixOrthographicLH(float ViewWidth, float ViewHe #elif defined(_XM_ARM_NEON_INTRINSICS_) float fRange = 1.0f / (FarZ - NearZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(2.0f / ViewWidth, Zero, 0); M.r[1] = vsetq_lane_f32(2.0f / ViewHeight, Zero, 1); @@ -3009,7 +3009,7 @@ inline XMMATRIX XM_CALLCONV XMMatrixOrthographicRH(float ViewWidth, float ViewHe #elif defined(_XM_ARM_NEON_INTRINSICS_) float fRange = 1.0f / (NearZ - FarZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(2.0f / ViewWidth, Zero, 0); M.r[1] = vsetq_lane_f32(2.0f / ViewHeight, Zero, 1); @@ -3086,7 +3086,7 @@ XMMatrixOrthographicOffCenterLH(float ViewLeft, float ViewRight, float ViewBotto float ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); float ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); float fRange = 1.0f / (FarZ - NearZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(ReciprocalWidth + ReciprocalWidth, Zero, 0); M.r[1] = vsetq_lane_f32(ReciprocalHeight + ReciprocalHeight, Zero, 1); @@ -3163,7 +3163,7 @@ XMMatrixOrthographicOffCenterRH(float ViewLeft, float ViewRight, float ViewBotto float ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); float ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); float fRange = 1.0f / (NearZ - FarZ); - const float32x4_t Zero = vdupq_n_f32(0); + float32x4_t const Zero = vdupq_n_f32(0); XMMATRIX M; M.r[0] = vsetq_lane_f32(ReciprocalWidth + ReciprocalWidth, Zero, 0); M.r[1] = vsetq_lane_f32(ReciprocalHeight + ReciprocalHeight, Zero, 1); @@ -3238,7 +3238,7 @@ inline XMMATRIX::XMMATRIX(float m00, } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMMATRIX::XMMATRIX(const float* pArray) noexcept +_Use_decl_annotations_ inline XMMATRIX::XMMATRIX(float const* pArray) noexcept { assert(pArray != nullptr); r[0] = XMLoadFloat4(reinterpret_cast(pArray)); @@ -3452,7 +3452,7 @@ inline XMMATRIX XM_CALLCONV operator*(float S, FXMMATRIX M) noexcept ****************************************************************************/ //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMFLOAT3X3::XMFLOAT3X3(const float* pArray) noexcept +_Use_decl_annotations_ inline XMFLOAT3X3::XMFLOAT3X3(float const* pArray) noexcept { assert(pArray != nullptr); for (size_t Row = 0; Row < 3; Row++) @@ -3471,7 +3471,7 @@ _Use_decl_annotations_ inline XMFLOAT3X3::XMFLOAT3X3(const float* pArray) noexce ****************************************************************************/ //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMFLOAT4X3::XMFLOAT4X3(const float* pArray) noexcept +_Use_decl_annotations_ inline XMFLOAT4X3::XMFLOAT4X3(float const* pArray) noexcept { assert(pArray != nullptr); @@ -3499,7 +3499,7 @@ _Use_decl_annotations_ inline XMFLOAT4X3::XMFLOAT4X3(const float* pArray) noexce ****************************************************************************/ //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMFLOAT3X4::XMFLOAT3X4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMFLOAT3X4::XMFLOAT3X4(float const* pArray) noexcept { assert(pArray != nullptr); @@ -3526,7 +3526,7 @@ _Use_decl_annotations_ inline XMFLOAT3X4::XMFLOAT3X4(const float* pArray) noexce ****************************************************************************/ //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMFLOAT4X4::XMFLOAT4X4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMFLOAT4X4::XMFLOAT4X4(float const* pArray) noexcept { assert(pArray != nullptr); diff --git a/Inc/DirectXMathMisc.inl b/Inc/DirectXMathMisc.inl index 5e84aed..64749c9 100644 --- a/Inc/DirectXMathMisc.inl +++ b/Inc/DirectXMathMisc.inl @@ -510,15 +510,15 @@ inline XMVECTOR XM_CALLCONV XMQuaternionIdentity() noexcept inline XMVECTOR XM_CALLCONV XMQuaternionRotationRollPitchYaw(float Pitch, float Yaw, float Roll) noexcept { #if defined(_XM_NO_INTRINSICS_) - const float halfpitch = Pitch * 0.5f; + float const halfpitch = Pitch * 0.5f; float cp = cosf(halfpitch); float sp = sinf(halfpitch); - const float halfyaw = Yaw * 0.5f; + float const halfyaw = Yaw * 0.5f; float cy = cosf(halfyaw); float sy = sinf(halfyaw); - const float halfroll = Roll * 0.5f; + float const halfroll = Roll * 0.5f; float cr = cosf(halfroll); float sr = sinf(halfroll); @@ -537,15 +537,15 @@ inline XMVECTOR XM_CALLCONV XMQuaternionRotationRollPitchYawFromVector(FXMVECTOR ) noexcept { #if defined(_XM_NO_INTRINSICS_) - const float halfpitch = Angles.vector4_f32[0] * 0.5f; + float const halfpitch = Angles.vector4_f32[0] * 0.5f; float cp = cosf(halfpitch); float sp = sinf(halfpitch); - const float halfyaw = Angles.vector4_f32[1] * 0.5f; + float const halfyaw = Angles.vector4_f32[1] * 0.5f; float cy = cosf(halfyaw); float sy = sinf(halfyaw); - const float halfroll = Angles.vector4_f32[2] * 0.5f; + float const halfroll = Angles.vector4_f32[2] * 0.5f; float cr = cosf(halfroll); float sr = sinf(halfroll); diff --git a/Inc/DirectXMathVector.inl b/Inc/DirectXMathVector.inl index c88c73c..eea8943 100644 --- a/Inc/DirectXMathVector.inl +++ b/Inc/DirectXMathVector.inl @@ -63,10 +63,10 @@ inline XMVECTOR XM_CALLCONV XMVectorSet(float x, float y, float z, float w) noex XMVECTORF32 vResult = { { { x, y, z, w } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - float32x2_t V0 = vcreate_f32(static_cast(*reinterpret_cast(&x)) - | (static_cast(*reinterpret_cast(&y)) << 32)); - float32x2_t V1 = vcreate_f32(static_cast(*reinterpret_cast(&z)) - | (static_cast(*reinterpret_cast(&w)) << 32)); + float32x2_t V0 = vcreate_f32(static_cast(*reinterpret_cast(&x)) + | (static_cast(*reinterpret_cast(&y)) << 32)); + float32x2_t V1 = vcreate_f32(static_cast(*reinterpret_cast(&z)) + | (static_cast(*reinterpret_cast(&w)) << 32)); return vcombine_f32(V0, V1); #elif defined(_XM_SSE_INTRINSICS_) return _mm_set_ps(w, z, y, x); @@ -107,7 +107,7 @@ inline XMVECTOR XM_CALLCONV XMVectorReplicate(float Value) noexcept //------------------------------------------------------------------------------ // Initialize a vector with a replicated floating point value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorReplicatePtr(const float* pValue) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorReplicatePtr(float const* pValue) noexcept { #if defined(_XM_NO_INTRINSICS_) float Value = pValue[0]; @@ -141,7 +141,7 @@ inline XMVECTOR XM_CALLCONV XMVectorReplicateInt(uint32_t Value) noexcept //------------------------------------------------------------------------------ // Initialize a vector with a replicated integer value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorReplicateIntPtr(const uint32_t* pValue) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorReplicateIntPtr(uint32_t const* pValue) noexcept { #if defined(_XM_NO_INTRINSICS_) uint32_t Value = pValue[0]; @@ -151,7 +151,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorReplicateIntPtr(const #elif defined(_XM_ARM_NEON_INTRINSICS_) return vreinterpretq_f32_u32(vld1q_dup_u32(pValue)); #elif defined(_XM_SSE_INTRINSICS_) - return _mm_load_ps1(reinterpret_cast(pValue)); + return _mm_load_ps1(reinterpret_cast(pValue)); #endif } @@ -575,7 +575,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMVectorGetIntXPtr(uint32_t* x, F #if defined(_XM_NO_INTRINSICS_) *x = V.vector4_u32[0]; #elif defined(_XM_ARM_NEON_INTRINSICS_) - vst1q_lane_u32(x, *reinterpret_cast(&V), 0); + vst1q_lane_u32(x, *reinterpret_cast(&V), 0); #elif defined(_XM_SSE_INTRINSICS_) _mm_store_ss(reinterpret_cast(x), V); #endif @@ -588,7 +588,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMVectorGetIntYPtr(uint32_t* y, F #if defined(_XM_NO_INTRINSICS_) *y = V.vector4_u32[1]; #elif defined(_XM_ARM_NEON_INTRINSICS_) - vst1q_lane_u32(y, *reinterpret_cast(&V), 1); + vst1q_lane_u32(y, *reinterpret_cast(&V), 1); #elif defined(_XM_SSE4_INTRINSICS_) __m128i V1 = _mm_castps_si128(V); *y = static_cast(_mm_extract_epi32(V1, 1)); @@ -605,7 +605,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMVectorGetIntZPtr(uint32_t* z, F #if defined(_XM_NO_INTRINSICS_) *z = V.vector4_u32[2]; #elif defined(_XM_ARM_NEON_INTRINSICS_) - vst1q_lane_u32(z, *reinterpret_cast(&V), 2); + vst1q_lane_u32(z, *reinterpret_cast(&V), 2); #elif defined(_XM_SSE4_INTRINSICS_) __m128i V1 = _mm_castps_si128(V); *z = static_cast(_mm_extract_epi32(V1, 2)); @@ -622,7 +622,7 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMVectorGetIntWPtr(uint32_t* w, F #if defined(_XM_NO_INTRINSICS_) *w = V.vector4_u32[3]; #elif defined(_XM_ARM_NEON_INTRINSICS_) - vst1q_lane_u32(w, *reinterpret_cast(&V), 3); + vst1q_lane_u32(w, *reinterpret_cast(&V), 3); #elif defined(_XM_SSE4_INTRINSICS_) __m128i V1 = _mm_castps_si128(V); *w = static_cast(_mm_extract_epi32(V1, 3)); @@ -739,7 +739,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSetW(FXMVECTOR V, float w) noexcept //------------------------------------------------------------------------------ // Sets a component of a vector to a floating point value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetByIndexPtr(FXMVECTOR V, const float* f, size_t i) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetByIndexPtr(FXMVECTOR V, float const* f, size_t i) noexcept { assert(f != nullptr); assert(i < 4); @@ -753,7 +753,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetByIndexPtr(FXMVECT //------------------------------------------------------------------------------ // Sets the X component of a vector to a floating point value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetXPtr(FXMVECTOR V, const float* x) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetXPtr(FXMVECTOR V, float const* x) noexcept { assert(x != nullptr); #if defined(_XM_NO_INTRINSICS_) @@ -769,7 +769,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetXPtr(FXMVECTOR V, } // Sets the Y component of a vector to a floating point value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetYPtr(FXMVECTOR V, const float* y) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetYPtr(FXMVECTOR V, float const* y) noexcept { assert(y != nullptr); #if defined(_XM_NO_INTRINSICS_) @@ -791,7 +791,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetYPtr(FXMVECTOR V, } // Sets the Z component of a vector to a floating point value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetZPtr(FXMVECTOR V, const float* z) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetZPtr(FXMVECTOR V, float const* z) noexcept { assert(z != nullptr); #if defined(_XM_NO_INTRINSICS_) @@ -813,7 +813,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetZPtr(FXMVECTOR V, } // Sets the W component of a vector to a floating point value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetWPtr(FXMVECTOR V, const float* w) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetWPtr(FXMVECTOR V, float const* w) noexcept { assert(w != nullptr); #if defined(_XM_NO_INTRINSICS_) @@ -942,7 +942,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSetIntW(FXMVECTOR V, uint32_t w) noexcept //------------------------------------------------------------------------------ // Sets a component of a vector to an integer value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntByIndexPtr(FXMVECTOR V, const uint32_t* x, size_t i) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntByIndexPtr(FXMVECTOR V, uint32_t const* x, size_t i) noexcept { assert(x != nullptr); assert(i < 4); @@ -956,35 +956,35 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntByIndexPtr(FXMV //------------------------------------------------------------------------------ // Sets the X component of a vector to an integer value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntXPtr(FXMVECTOR V, const uint32_t* x) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntXPtr(FXMVECTOR V, uint32_t const* x) noexcept { assert(x != nullptr); #if defined(_XM_NO_INTRINSICS_) XMVECTORU32 U = { { { *x, V.vector4_u32[1], V.vector4_u32[2], V.vector4_u32[3] } } }; return U.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - return vreinterpretq_f32_u32(vld1q_lane_u32(x, *reinterpret_cast(&V), 0)); + return vreinterpretq_f32_u32(vld1q_lane_u32(x, *reinterpret_cast(&V), 0)); #elif defined(_XM_SSE_INTRINSICS_) - XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(x)); + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(x)); XMVECTOR vResult = _mm_move_ss(V, vTemp); return vResult; #endif } // Sets the Y component of a vector to an integer value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntYPtr(FXMVECTOR V, const uint32_t* y) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntYPtr(FXMVECTOR V, uint32_t const* y) noexcept { assert(y != nullptr); #if defined(_XM_NO_INTRINSICS_) XMVECTORU32 U = { { { V.vector4_u32[0], *y, V.vector4_u32[2], V.vector4_u32[3] } } }; return U.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - return vreinterpretq_f32_u32(vld1q_lane_u32(y, *reinterpret_cast(&V), 1)); + return vreinterpretq_f32_u32(vld1q_lane_u32(y, *reinterpret_cast(&V), 1)); #elif defined(_XM_SSE_INTRINSICS_) // Swap y and x XMVECTOR vResult = XM_PERMUTE_PS(V, _MM_SHUFFLE(3, 2, 0, 1)); // Convert input to vector - XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(y)); + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(y)); // Replace the x component vResult = _mm_move_ss(vResult, vTemp); // Swap y and x again @@ -994,19 +994,19 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntYPtr(FXMVECTOR } // Sets the Z component of a vector to an integer value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntZPtr(FXMVECTOR V, const uint32_t* z) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntZPtr(FXMVECTOR V, uint32_t const* z) noexcept { assert(z != nullptr); #if defined(_XM_NO_INTRINSICS_) XMVECTORU32 U = { { { V.vector4_u32[0], V.vector4_u32[1], *z, V.vector4_u32[3] } } }; return U.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - return vreinterpretq_f32_u32(vld1q_lane_u32(z, *reinterpret_cast(&V), 2)); + return vreinterpretq_f32_u32(vld1q_lane_u32(z, *reinterpret_cast(&V), 2)); #elif defined(_XM_SSE_INTRINSICS_) // Swap z and x XMVECTOR vResult = XM_PERMUTE_PS(V, _MM_SHUFFLE(3, 0, 1, 2)); // Convert input to vector - XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(z)); + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(z)); // Replace the x component vResult = _mm_move_ss(vResult, vTemp); // Swap z and x again @@ -1016,19 +1016,19 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntZPtr(FXMVECTOR } // Sets the W component of a vector to an integer value passed by pointer -_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntWPtr(FXMVECTOR V, const uint32_t* w) noexcept +_Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMVectorSetIntWPtr(FXMVECTOR V, uint32_t const* w) noexcept { assert(w != nullptr); #if defined(_XM_NO_INTRINSICS_) XMVECTORU32 U = { { { V.vector4_u32[0], V.vector4_u32[1], V.vector4_u32[2], *w } } }; return U.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - return vreinterpretq_f32_u32(vld1q_lane_u32(w, *reinterpret_cast(&V), 3)); + return vreinterpretq_f32_u32(vld1q_lane_u32(w, *reinterpret_cast(&V), 3)); #elif defined(_XM_SSE_INTRINSICS_) // Swap w and x XMVECTOR vResult = XM_PERMUTE_PS(V, _MM_SHUFFLE(0, 2, 1, 3)); // Convert input to vector - XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(w)); + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(w)); // Replace the x component vResult = _mm_move_ss(vResult, vTemp); // Swap w and x again @@ -1049,7 +1049,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSwizzle(FXMVECTOR V, uint32_t E0, uint32_t E return Result.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - static const uint32_t ControlElement[4] = { + static uint32_t const ControlElement[4] = { 0x03020100, // XM_SWIZZLE_X 0x07060504, // XM_SWIZZLE_Y 0x0B0A0908, // XM_SWIZZLE_Z @@ -1061,24 +1061,24 @@ inline XMVECTOR XM_CALLCONV XMVectorSwizzle(FXMVECTOR V, uint32_t E0, uint32_t E tbl.val[1] = vreinterpret_u8_f32(vget_high_f32(V)); uint32x2_t idx = vcreate_u32(static_cast(ControlElement[E0]) | (static_cast(ControlElement[E1]) << 32)); - const uint8x8_t rL = vtbl2_u8(tbl, vreinterpret_u8_u32(idx)); + uint8x8_t const rL = vtbl2_u8(tbl, vreinterpret_u8_u32(idx)); idx = vcreate_u32(static_cast(ControlElement[E2]) | (static_cast(ControlElement[E3]) << 32)); - const uint8x8_t rH = vtbl2_u8(tbl, vreinterpret_u8_u32(idx)); + uint8x8_t const rH = vtbl2_u8(tbl, vreinterpret_u8_u32(idx)); return vcombine_f32(vreinterpret_f32_u8(rL), vreinterpret_f32_u8(rH)); #elif defined(_XM_AVX_INTRINSICS_) unsigned int elem[4] = { E0, E1, E2, E3 }; - __m128i vControl = _mm_loadu_si128(reinterpret_cast(&elem[0])); + __m128i vControl = _mm_loadu_si128(reinterpret_cast<__m128i const*>(&elem[0])); return _mm_permutevar_ps(V, vControl); #else #if defined(__GNUC__) && !defined(__clang__) // workaround some GCC optimization behavior that breaks this function XMVECTORU32 T; T.v = V; - auto aPtr = reinterpret_cast(&T); + auto aPtr = reinterpret_cast(&T); #else - auto aPtr = reinterpret_cast(&V); + auto aPtr = reinterpret_cast(&V); #endif XMVECTORU32 vResult; @@ -1099,7 +1099,7 @@ XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, uint32_t PermuteX, uint32_t PermuteY _Analysis_assume_(PermuteX <= 7 && PermuteY <= 7 && PermuteZ <= 7 && PermuteW <= 7); #if defined(_XM_ARM_NEON_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) - static const uint32_t ControlElement[8] = { + static uint32_t const ControlElement[8] = { 0x03020100, // XM_PERMUTE_0X 0x07060504, // XM_PERMUTE_0Y 0x0B0A0908, // XM_PERMUTE_0Z @@ -1117,17 +1117,17 @@ XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, uint32_t PermuteX, uint32_t PermuteY tbl.val[3] = vreinterpret_u8_f32(vget_high_f32(V2)); uint32x2_t idx = vcreate_u32(static_cast(ControlElement[PermuteX]) | (static_cast(ControlElement[PermuteY]) << 32)); - const uint8x8_t rL = vtbl4_u8(tbl, vreinterpret_u8_u32(idx)); + uint8x8_t const rL = vtbl4_u8(tbl, vreinterpret_u8_u32(idx)); idx = vcreate_u32(static_cast(ControlElement[PermuteZ]) | (static_cast(ControlElement[PermuteW]) << 32)); - const uint8x8_t rH = vtbl4_u8(tbl, vreinterpret_u8_u32(idx)); + uint8x8_t const rH = vtbl4_u8(tbl, vreinterpret_u8_u32(idx)); return vcombine_f32(vreinterpret_f32_u8(rL), vreinterpret_f32_u8(rH)); #elif defined(_XM_AVX_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) static const XMVECTORU32 three = { { { 3, 3, 3, 3 } } }; XM_ALIGNED_DATA(16) unsigned int elem[4] = { PermuteX, PermuteY, PermuteZ, PermuteW }; - __m128i vControl = _mm_load_si128(reinterpret_cast(&elem[0])); + __m128i vControl = _mm_load_si128(reinterpret_cast<__m128i const*>(&elem[0])); __m128i vSelect = _mm_cmpgt_epi32(vControl, three); vControl = _mm_castps_si128(_mm_and_ps(_mm_castsi128_ps(vControl), three)); @@ -1141,7 +1141,7 @@ XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, uint32_t PermuteX, uint32_t PermuteY return _mm_or_ps(masked1, masked2); #else - const uint32_t* aPtr[2]; + uint32_t const* aPtr[2]; #if defined(__GNUC__) && !defined(__clang__) // workaround some GCC optimization behavior that breaks this function @@ -1149,28 +1149,28 @@ XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, uint32_t PermuteX, uint32_t PermuteY T1.v = V1; XMVECTORU32 T2; T2.v = V2; - aPtr[0] = reinterpret_cast(&T1); - aPtr[1] = reinterpret_cast(&T2); + aPtr[0] = reinterpret_cast(&T1); + aPtr[1] = reinterpret_cast(&T2); #else - aPtr[0] = reinterpret_cast(&V1); - aPtr[1] = reinterpret_cast(&V2); + aPtr[0] = reinterpret_cast(&V1); + aPtr[1] = reinterpret_cast(&V2); #endif XMVECTORU32 vResult; - const uint32_t i0 = PermuteX & 3; - const uint32_t vi0 = PermuteX >> 2; + uint32_t const i0 = PermuteX & 3; + uint32_t const vi0 = PermuteX >> 2; vResult.u[0] = aPtr[vi0][i0]; - const uint32_t i1 = PermuteY & 3; - const uint32_t vi1 = PermuteY >> 2; + uint32_t const i1 = PermuteY & 3; + uint32_t const vi1 = PermuteY >> 2; vResult.u[1] = aPtr[vi1][i1]; - const uint32_t i2 = PermuteZ & 3; - const uint32_t vi2 = PermuteZ >> 2; + uint32_t const i2 = PermuteZ & 3; + uint32_t const vi2 = PermuteZ >> 2; vResult.u[2] = aPtr[vi2][i2]; - const uint32_t i3 = PermuteW & 3; - const uint32_t vi3 = PermuteW >> 2; + uint32_t const i3 = PermuteW & 3; + uint32_t const vi3 = PermuteW >> 2; vResult.u[3] = aPtr[vi3][i3]; return vResult.v; @@ -1210,7 +1210,7 @@ inline XMVECTOR XM_CALLCONV XMVectorSelectControl(uint32_t VectorIndex0, return vreinterpretq_f32_u32(vcgtq_s32(vTemp, g_XMZero)); #else XMVECTOR ControlVector; - const uint32_t ControlElement[] = { XM_SELECT_0, XM_SELECT_1 }; + uint32_t const ControlElement[] = { XM_SELECT_0, XM_SELECT_1 }; assert(VectorIndex0 < 2); assert(VectorIndex1 < 2); @@ -3078,7 +3078,7 @@ namespace MathInternal return _mm_castps_si128(result); } - inline __m128i GetLeadingBit(const __m128i value) noexcept + inline __m128i GetLeadingBit(__m128i const value) noexcept { static const XMVECTORI32 g_XM0000FFFF = { { { 0x0000FFFF, 0x0000FFFF, 0x0000FFFF, 0x0000FFFF } } }; static const XMVECTORI32 g_XM000000FF = { { { 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF } } }; @@ -3122,7 +3122,7 @@ namespace MathInternal namespace MathInternal { - inline int32x4_t GetLeadingBit(const int32x4_t value) noexcept + inline int32x4_t GetLeadingBit(int32x4_t const value) noexcept { static const XMVECTORI32 g_XM0000FFFF = { { { 0x0000FFFF, 0x0000FFFF, 0x0000FFFF, 0x0000FFFF } } }; static const XMVECTORI32 g_XM000000FF = { { { 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF } } }; @@ -6190,7 +6190,7 @@ inline XMVECTOR XM_CALLCONV XMVector2LengthEst(FXMVECTOR V) noexcept // Dot2 float32x2_t vTemp = vmul_f32(VL, VL); vTemp = vpadd_f32(vTemp, vTemp); - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); uint32x2_t VEqualsZero = vceq_f32(vTemp, zero); // Sqrt (estimate) float32x2_t Result = vrsqrte_f32(vTemp); @@ -6235,7 +6235,7 @@ inline XMVECTOR XM_CALLCONV XMVector2Length(FXMVECTOR V) noexcept // Dot2 float32x2_t vTemp = vmul_f32(VL, VL); vTemp = vpadd_f32(vTemp, vTemp); - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); uint32x2_t VEqualsZero = vceq_f32(vTemp, zero); // Sqrt float32x2_t S0 = vrsqrte_f32(vTemp); @@ -6604,7 +6604,7 @@ inline XMVECTOR XM_CALLCONV XMVector2Orthogonal(FXMVECTOR V) noexcept #elif defined(_XM_ARM_NEON_INTRINSICS_) static const XMVECTORF32 Negate = { { { -1.f, 1.f, 0, 0 } } }; - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); float32x2_t VL = vget_low_f32(V); float32x2_t Result = vmul_f32(vrev64_f32(VL), vget_low_f32(Negate)); @@ -6799,7 +6799,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -6833,7 +6833,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -6848,7 +6848,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF { for (size_t j = 0; j < four; ++j) { - float32x4x2_t V = vld2q_f32(reinterpret_cast(pInputVector)); + float32x4x2_t V = vld2q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; float32x2_t r3 = vget_low_f32(row3); @@ -6893,7 +6893,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF for (; i < VectorCount; i++) { - float32x2_t V = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t V = vld1_f32(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vResult = vmlaq_lane_f32(row3, row0, V, 0); // X @@ -6905,7 +6905,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF return pOutputStream; #elif defined(_XM_AVX2_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -6925,7 +6925,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -6956,7 +6956,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -6988,7 +6988,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7029,7 +7029,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF for (; i < VectorCount; i++) { - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(xy, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7048,7 +7048,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7066,7 +7066,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Packed input, aligned output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; XMVECTOR Y = XM_PERMUTE_PS(V, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7097,7 +7097,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Packed input, unaligned output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; XMVECTOR Y = XM_PERMUTE_PS(V, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7133,7 +7133,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Aligned input, aligned output for (; i < VectorCount; i++) { - XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast(pInputVector))); + XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast<__m128i const*>(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(V, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7152,7 +7152,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Aligned input, unaligned output for (; i < VectorCount; i++) { - XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast(pInputVector))); + XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast<__m128i const*>(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(V, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7172,7 +7172,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector2TransformStream(XMF // Unaligned input for (; i < VectorCount; i++) { - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(xy, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7227,7 +7227,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7265,7 +7265,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7280,7 +7280,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea { for (size_t j = 0; j < four; ++j) { - float32x4x2_t V = vld2q_f32(reinterpret_cast(pInputVector)); + float32x4x2_t V = vld2q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; float32x2_t r3 = vget_low_f32(row3); @@ -7332,7 +7332,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea for (; i < VectorCount; i++) { - float32x2_t V = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t V = vld1_f32(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vResult = vmlaq_lane_f32(row3, row0, V, 0); // X @@ -7362,7 +7362,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea return pOutputStream; #elif defined(_XM_AVX2_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -7382,7 +7382,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7415,7 +7415,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7449,7 +7449,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7496,7 +7496,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea for (; i < VectorCount; i++) { - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(xy, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7518,7 +7518,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7538,7 +7538,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Packed input, aligned & packed output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; // Result 1 @@ -7578,7 +7578,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Packed input, unaligned & packed output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; // Result 1 @@ -7619,7 +7619,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Packed input, unpacked output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; // Result 1 @@ -7663,7 +7663,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Aligned input for (; i < VectorCount; i++) { - XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast(pInputVector))); + XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast<__m128i const*>(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(V, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7686,7 +7686,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformCoordStrea // Unaligned input for (; i < VectorCount; i++) { - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(xy, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7758,7 +7758,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7791,7 +7791,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7805,7 +7805,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre { for (size_t j = 0; j < four; ++j) { - float32x4x2_t V = vld2q_f32(reinterpret_cast(pInputVector)); + float32x4x2_t V = vld2q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; float32x2_t r = vget_low_f32(row0); @@ -7835,7 +7835,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre for (; i < VectorCount; i++) { - float32x2_t V = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t V = vld1_f32(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vResult = vmulq_lane_f32(row0, V, 0); // X @@ -7848,7 +7848,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre return pOutputStream; #elif defined(_XM_AVX2_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -7867,7 +7867,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7892,7 +7892,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7918,7 +7918,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 4; __m256 Y2 = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(3, 3, 3, 3)); @@ -7956,7 +7956,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre for (; i < VectorCount; i++) { - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(xy, _MM_SHUFFLE(1, 1, 1, 1)); @@ -7974,7 +7974,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -7993,7 +7993,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Packed input, aligned & packed output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; // Result 1 @@ -8023,7 +8023,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Packed input, unaligned & packed output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; // Result 1 @@ -8054,7 +8054,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Packed input, unpacked output for (size_t j = 0; j < two; ++j) { - XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT2) * 2; // Result 1 @@ -8088,7 +8088,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Aligned input for (; i < VectorCount; i++) { - XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast(pInputVector))); + XMVECTOR V = _mm_castsi128_ps(_mm_loadl_epi64(reinterpret_cast<__m128i const*>(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(V, _MM_SHUFFLE(1, 1, 1, 1)); @@ -8106,7 +8106,7 @@ _Use_decl_annotations_ inline XMFLOAT2* XM_CALLCONV XMVector2TransformNormalStre // Unaligned input for (; i < VectorCount; i++) { - __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); + __m128 xy = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(pInputVector))); pInputVector += InputStride; XMVECTOR Y = XM_PERMUTE_PS(xy, _MM_SHUFFLE(1, 1, 1, 1)); @@ -8851,7 +8851,7 @@ inline XMVECTOR XM_CALLCONV XMVector3LengthEst(FXMVECTOR V) noexcept v1 = vpadd_f32(v1, v1); v2 = vdup_lane_f32(v2, 0); v1 = vadd_f32(v1, v2); - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); uint32x2_t VEqualsZero = vceq_f32(v1, zero); // Sqrt (estimate) float32x2_t Result = vrsqrte_f32(v1); @@ -8908,7 +8908,7 @@ inline XMVECTOR XM_CALLCONV XMVector3Length(FXMVECTOR V) noexcept v1 = vpadd_f32(v1, v1); v2 = vdup_lane_f32(v2, 0); v1 = vadd_f32(v1, v2); - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); uint32x2_t VEqualsZero = vceq_f32(v1, zero); // Sqrt float32x2_t S0 = vrsqrte_f32(v1); @@ -9482,7 +9482,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -9510,7 +9510,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -9526,7 +9526,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF { for (size_t j = 0; j < four; ++j) { - float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); + float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT3) * 4; float32x2_t r3 = vget_low_f32(row3); @@ -9583,9 +9583,9 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF for (; i < VectorCount; i++) { - float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); float32x2_t zero = vdup_n_f32(0); - float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); + float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); pInputVector += InputStride; XMVECTOR vResult = vmlaq_lane_f32(row3, row0, VL, 0); // X @@ -9598,7 +9598,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -9617,9 +9617,9 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF // Packed input, aligned output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -9685,9 +9685,9 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector3TransformStream(XMF // Packed input, unaligned output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -9847,7 +9847,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -9879,7 +9879,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -9895,7 +9895,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea { for (size_t j = 0; j < four; ++j) { - float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); + float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT3) * 4; float32x2_t r3 = vget_low_f32(row3); @@ -9963,9 +9963,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea for (; i < VectorCount; i++) { - float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); float32x2_t zero = vdup_n_f32(0); - float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); + float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); pInputVector += InputStride; XMVECTOR vResult = vmlaq_lane_f32(row3, row0, VL, 0); // X @@ -9996,7 +9996,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -10017,9 +10017,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -10099,9 +10099,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea // Packed input, unaligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -10182,9 +10182,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformCoordStrea // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -10354,7 +10354,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -10381,7 +10381,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -10396,7 +10396,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre { for (size_t j = 0; j < four; ++j) { - float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); + float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT3) * 4; float32x2_t r = vget_low_f32(row0); @@ -10446,9 +10446,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre for (; i < VectorCount; i++) { - float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); float32x2_t zero = vdup_n_f32(0); - float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); + float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); pInputVector += InputStride; XMVECTOR vResult = vmulq_lane_f32(row0, VL, 0); // X @@ -10463,7 +10463,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -10483,9 +10483,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -10549,9 +10549,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre // Packed input, unaligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -10616,9 +10616,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3TransformNormalStre // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -10728,8 +10728,8 @@ inline XMVECTOR XM_CALLCONV XMVector3Project(FXMVECTOR V, CXMMATRIX View, CXMMATRIX World) noexcept { - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMVECTOR Scale = XMVectorSet(HalfViewportWidth, -HalfViewportHeight, ViewportMaxZ - ViewportMinZ, 0.0f); XMVECTOR Offset = XMVectorSet(ViewportX + HalfViewportWidth, ViewportY + HalfViewportHeight, ViewportMinZ, 0.0f); @@ -10777,8 +10777,8 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO #if defined(_XM_NO_INTRINSICS_) - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMVECTOR Scale = XMVectorSet(HalfViewportWidth, -HalfViewportHeight, ViewportMaxZ - ViewportMinZ, 1.0f); XMVECTOR Offset = XMVectorSet(ViewportX + HalfViewportWidth, ViewportY + HalfViewportHeight, ViewportMinZ, 0.0f); @@ -10786,7 +10786,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO XMMATRIX Transform = XMMatrixMultiply(World, View); Transform = XMMatrixMultiply(Transform, Projection); - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); for (size_t i = 0; i < VectorCount; i++) @@ -10805,13 +10805,13 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMMATRIX Transform = XMMatrixMultiply(World, View); Transform = XMMatrixMultiply(Transform, Projection); - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -10830,7 +10830,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO for (size_t j = 0; j < four; ++j) { - float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); + float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT3) * 4; float32x2_t r3 = vget_low_f32(Transform.r[3]); @@ -10907,9 +10907,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO for (; i < VectorCount; i++) { - float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); float32x2_t zero = vdup_n_f32(0); - float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); + float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); pInputVector += InputStride; XMVECTOR vResult = vmlaq_lane_f32(Transform.r[3], Transform.r[2], VH, 0); // Z @@ -10943,8 +10943,8 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - const float HalfViewportWidth = ViewportWidth * 0.5f; - const float HalfViewportHeight = ViewportHeight * 0.5f; + float const HalfViewportWidth = ViewportWidth * 0.5f; + float const HalfViewportHeight = ViewportHeight * 0.5f; XMVECTOR Scale = XMVectorSet(HalfViewportWidth, -HalfViewportHeight, ViewportMaxZ - ViewportMinZ, 1.0f); XMVECTOR Offset = XMVectorSet(ViewportX + HalfViewportWidth, ViewportY + HalfViewportHeight, ViewportMinZ, 0.0f); @@ -10952,7 +10952,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO XMMATRIX Transform = XMMatrixMultiply(World, View); Transform = XMMatrixMultiply(Transform, Projection); - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -10968,9 +10968,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -11050,9 +11050,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO // Packed input, unaligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -11133,9 +11133,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3ProjectStream(XMFLO // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -11327,7 +11327,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF Transform = XMMatrixMultiply(Transform, Projection); Transform = XMMatrixInverse(nullptr, Transform); - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); for (size_t i = 0; i < VectorCount; i++) @@ -11351,7 +11351,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF Transform = XMMatrixMultiply(Transform, Projection); Transform = XMMatrixInverse(nullptr, Transform); - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); float sx = 1.f / (ViewportWidth * 0.5f); @@ -11370,7 +11370,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF { for (size_t j = 0; j < four; ++j) { - float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); + float32x4x3_t V = vld3q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT3) * 4; XMVECTOR ScaleX = vdupq_n_f32(sx); @@ -11450,19 +11450,19 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF if (i < VectorCount) { - float32x2_t ScaleL = vcreate_f32(static_cast(*reinterpret_cast(&sx)) - | (static_cast(*reinterpret_cast(&sy)) << 32)); - float32x2_t ScaleH = vcreate_f32(static_cast(*reinterpret_cast(&sz))); + float32x2_t ScaleL = vcreate_f32(static_cast(*reinterpret_cast(&sx)) + | (static_cast(*reinterpret_cast(&sy)) << 32)); + float32x2_t ScaleH = vcreate_f32(static_cast(*reinterpret_cast(&sz))); - float32x2_t OffsetL = vcreate_f32(static_cast(*reinterpret_cast(&ox)) - | (static_cast(*reinterpret_cast(&oy)) << 32)); - float32x2_t OffsetH = vcreate_f32(static_cast(*reinterpret_cast(&oz))); + float32x2_t OffsetL = vcreate_f32(static_cast(*reinterpret_cast(&ox)) + | (static_cast(*reinterpret_cast(&oy)) << 32)); + float32x2_t OffsetH = vcreate_f32(static_cast(*reinterpret_cast(&oz))); for (; i < VectorCount; i++) { - float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); + float32x2_t VL = vld1_f32(reinterpret_cast(pInputVector)); float32x2_t zero = vdup_n_f32(0); - float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); + float32x2_t VH = vld1_lane_f32(reinterpret_cast(pInputVector) + 2, zero, 0); pInputVector += InputStride; VL = vmla_f32(OffsetL, VL, ScaleL); @@ -11510,7 +11510,7 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF Transform = XMMatrixMultiply(Transform, Projection); Transform = XMMatrixInverse(nullptr, Transform); - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -11526,9 +11526,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -11612,9 +11612,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF // Packed input, unaligned & packed output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -11699,9 +11699,9 @@ _Use_decl_annotations_ inline XMFLOAT3* XM_CALLCONV XMVector3UnprojectStream(XMF // Packed input, unpacked output for (size_t j = 0; j < four; ++j) { - __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); - __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); - __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); + __m128 V1 = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 L2 = _mm_loadu_ps(reinterpret_cast(pInputVector + 16)); + __m128 L3 = _mm_loadu_ps(reinterpret_cast(pInputVector + 32)); pInputVector += sizeof(XMFLOAT3) * 4; // Unpack the 4 vectors (.w components are junk) @@ -12411,83 +12411,83 @@ inline XMVECTOR XM_CALLCONV XMVector4Cross(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR return Result.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - const uint32x2_t select = vget_low_u32(g_XMMaskX); + uint32x2_t const select = vget_low_u32(g_XMMaskX); // Term1: V2zwyz * V3wzwy - const float32x2_t v2xy = vget_low_f32(V2); - const float32x2_t v2zw = vget_high_f32(V2); - const float32x2_t v2yx = vrev64_f32(v2xy); - const float32x2_t v2wz = vrev64_f32(v2zw); - const float32x2_t v2yz = vbsl_f32(select, v2yx, v2wz); + float32x2_t const v2xy = vget_low_f32(V2); + float32x2_t const v2zw = vget_high_f32(V2); + float32x2_t const v2yx = vrev64_f32(v2xy); + float32x2_t const v2wz = vrev64_f32(v2zw); + float32x2_t const v2yz = vbsl_f32(select, v2yx, v2wz); - const float32x2_t v3zw = vget_high_f32(V3); - const float32x2_t v3wz = vrev64_f32(v3zw); - const float32x2_t v3xy = vget_low_f32(V3); - const float32x2_t v3wy = vbsl_f32(select, v3wz, v3xy); + float32x2_t const v3zw = vget_high_f32(V3); + float32x2_t const v3wz = vrev64_f32(v3zw); + float32x2_t const v3xy = vget_low_f32(V3); + float32x2_t const v3wy = vbsl_f32(select, v3wz, v3xy); float32x4_t vTemp1 = vcombine_f32(v2zw, v2yz); float32x4_t vTemp2 = vcombine_f32(v3wz, v3wy); XMVECTOR vResult = vmulq_f32(vTemp1, vTemp2); // - V2wzwy * V3zwyz - const float32x2_t v2wy = vbsl_f32(select, v2wz, v2xy); + float32x2_t const v2wy = vbsl_f32(select, v2wz, v2xy); - const float32x2_t v3yx = vrev64_f32(v3xy); - const float32x2_t v3yz = vbsl_f32(select, v3yx, v3wz); + float32x2_t const v3yx = vrev64_f32(v3xy); + float32x2_t const v3yz = vbsl_f32(select, v3yx, v3wz); vTemp1 = vcombine_f32(v2wz, v2wy); vTemp2 = vcombine_f32(v3zw, v3yz); vResult = vmlsq_f32(vResult, vTemp1, vTemp2); // term1 * V1yxxx - const float32x2_t v1xy = vget_low_f32(V1); - const float32x2_t v1yx = vrev64_f32(v1xy); + float32x2_t const v1xy = vget_low_f32(V1); + float32x2_t const v1yx = vrev64_f32(v1xy); vTemp1 = vcombine_f32(v1yx, vdup_lane_f32(v1yx, 1)); vResult = vmulq_f32(vResult, vTemp1); // Term2: V2ywxz * V3wxwx - const float32x2_t v2yw = vrev64_f32(v2wy); - const float32x2_t v2xz = vbsl_f32(select, v2xy, v2wz); + float32x2_t const v2yw = vrev64_f32(v2wy); + float32x2_t const v2xz = vbsl_f32(select, v2xy, v2wz); - const float32x2_t v3wx = vbsl_f32(select, v3wz, v3yx); + float32x2_t const v3wx = vbsl_f32(select, v3wz, v3yx); vTemp1 = vcombine_f32(v2yw, v2xz); vTemp2 = vcombine_f32(v3wx, v3wx); float32x4_t vTerm = vmulq_f32(vTemp1, vTemp2); // - V2wxwx * V3ywxz - const float32x2_t v2wx = vbsl_f32(select, v2wz, v2yx); + float32x2_t const v2wx = vbsl_f32(select, v2wz, v2yx); - const float32x2_t v3yw = vrev64_f32(v3wy); - const float32x2_t v3xz = vbsl_f32(select, v3xy, v3wz); + float32x2_t const v3yw = vrev64_f32(v3wy); + float32x2_t const v3xz = vbsl_f32(select, v3xy, v3wz); vTemp1 = vcombine_f32(v2wx, v2wx); vTemp2 = vcombine_f32(v3yw, v3xz); vTerm = vmlsq_f32(vTerm, vTemp1, vTemp2); // vResult - term2 * V1zzyy - const float32x2_t v1zw = vget_high_f32(V1); + float32x2_t const v1zw = vget_high_f32(V1); vTemp1 = vcombine_f32(vdup_lane_f32(v1zw, 0), vdup_lane_f32(v1yx, 0)); vResult = vmlsq_f32(vResult, vTerm, vTemp1); // Term3: V2yzxy * V3zxyx - const float32x2_t v3zx = vrev64_f32(v3xz); + float32x2_t const v3zx = vrev64_f32(v3xz); vTemp1 = vcombine_f32(v2yz, v2xy); vTemp2 = vcombine_f32(v3zx, v3yx); vTerm = vmulq_f32(vTemp1, vTemp2); // - V2zxyx * V3yzxy - const float32x2_t v2zx = vrev64_f32(v2xz); + float32x2_t const v2zx = vrev64_f32(v2xz); vTemp1 = vcombine_f32(v2zx, v2yx); vTemp2 = vcombine_f32(v3yz, v3xy); vTerm = vmlsq_f32(vTerm, vTemp1, vTemp2); // vResult + term3 * V1wwwz - const float32x2_t v1wz = vrev64_f32(v1zw); + float32x2_t const v1wz = vrev64_f32(v1zw); vTemp1 = vcombine_f32(vdup_lane_f32(v1wz, 0), v1wz); return vmlaq_f32(vResult, vTerm, vTemp1); @@ -12674,7 +12674,7 @@ inline XMVECTOR XM_CALLCONV XMVector4LengthEst(FXMVECTOR V) noexcept float32x2_t v2 = vget_high_f32(vTemp); v1 = vadd_f32(v1, v2); v1 = vpadd_f32(v1, v1); - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); uint32x2_t VEqualsZero = vceq_f32(v1, zero); // Sqrt (estimate) float32x2_t Result = vrsqrte_f32(v1); @@ -12731,7 +12731,7 @@ inline XMVECTOR XM_CALLCONV XMVector4Length(FXMVECTOR V) noexcept float32x2_t v2 = vget_high_f32(vTemp); v1 = vadd_f32(v1, v2); v1 = vpadd_f32(v1, v1); - const float32x2_t zero = vdup_n_f32(0); + float32x2_t const zero = vdup_n_f32(0); uint32x2_t VEqualsZero = vceq_f32(v1, zero); // Sqrt float32x2_t S0 = vrsqrte_f32(v1); @@ -13248,7 +13248,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF #if defined(_XM_NO_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -13287,7 +13287,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -13303,7 +13303,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF { for (size_t j = 0; j < four; ++j) { - float32x4x4_t V = vld4q_f32(reinterpret_cast(pInputVector)); + float32x4x4_t V = vld4q_f32(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT4) * 4; float32x2_t r = vget_low_f32(row0); @@ -13369,7 +13369,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF for (; i < VectorCount; i++) { - XMVECTOR V = vld1q_f32(reinterpret_cast(pInputVector)); + XMVECTOR V = vld1q_f32(reinterpret_cast(pInputVector)); pInputVector += InputStride; float32x2_t VL = vget_low_f32(V); @@ -13385,7 +13385,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF return pOutputStream; #elif defined(_XM_AVX2_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); size_t i = 0; @@ -13406,7 +13406,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Packed input, aligned & packed output for (size_t j = 0; j < two; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT4) * 2; __m256 vTempX = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13431,7 +13431,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Packed input, packed output for (size_t j = 0; j < two; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT4) * 2; __m256 vTempX = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13457,7 +13457,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Packed input, unpacked output for (size_t j = 0; j < two; ++j) { - __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); + __m256 VV = _mm256_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += sizeof(XMFLOAT4) * 2; __m256 vTempX = _mm256_shuffle_ps(VV, VV, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13491,7 +13491,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF for (; i < VectorCount; i++) { - __m128 V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vTempX = XM_PERMUTE_PS(V, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13514,7 +13514,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF return pOutputStream; #elif defined(_XM_SSE_INTRINSICS_) - auto pInputVector = reinterpret_cast(pInputStream); + auto pInputVector = reinterpret_cast(pInputStream); auto pOutputVector = reinterpret_cast(pOutputStream); const XMVECTOR row0 = M.r[0]; @@ -13529,7 +13529,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Aligned input, aligned output for (size_t i = 0; i < VectorCount; i++) { - __m128 V = _mm_load_ps(reinterpret_cast(pInputVector)); + __m128 V = _mm_load_ps(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vTempX = XM_PERMUTE_PS(V, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13552,7 +13552,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Unaligned input, aligned output for (size_t i = 0; i < VectorCount; i++) { - __m128 V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vTempX = XM_PERMUTE_PS(V, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13578,7 +13578,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Aligned input, unaligned output for (size_t i = 0; i < VectorCount; i++) { - __m128 V = _mm_load_ps(reinterpret_cast(pInputVector)); + __m128 V = _mm_load_ps(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vTempX = XM_PERMUTE_PS(V, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13601,7 +13601,7 @@ _Use_decl_annotations_ inline XMFLOAT4* XM_CALLCONV XMVector4TransformStream(XMF // Unaligned input, unaligned output for (size_t i = 0; i < VectorCount; i++) { - __m128 V = _mm_loadu_ps(reinterpret_cast(pInputVector)); + __m128 V = _mm_loadu_ps(reinterpret_cast(pInputVector)); pInputVector += InputStride; XMVECTOR vTempX = XM_PERMUTE_PS(V, _MM_SHUFFLE(0, 0, 0, 0)); @@ -13683,7 +13683,7 @@ inline XMVECTOR& XM_CALLCONV operator/=(XMVECTOR& V1, FXMVECTOR V2) noexcept //------------------------------------------------------------------------------ -inline XMVECTOR& operator*=(XMVECTOR& V, const float S) noexcept +inline XMVECTOR& operator*=(XMVECTOR& V, float const S) noexcept { V = XMVectorScale(V, S); return V; @@ -13691,7 +13691,7 @@ inline XMVECTOR& operator*=(XMVECTOR& V, const float S) noexcept //------------------------------------------------------------------------------ -inline XMVECTOR& operator/=(XMVECTOR& V, const float S) noexcept +inline XMVECTOR& operator/=(XMVECTOR& V, float const S) noexcept { XMVECTOR vS = XMVectorReplicate(S); V = XMVectorDivide(V, vS); @@ -13728,14 +13728,14 @@ inline XMVECTOR XM_CALLCONV operator/(FXMVECTOR V1, FXMVECTOR V2) noexcept //------------------------------------------------------------------------------ -inline XMVECTOR XM_CALLCONV operator*(FXMVECTOR V, const float S) noexcept +inline XMVECTOR XM_CALLCONV operator*(FXMVECTOR V, float const S) noexcept { return XMVectorScale(V, S); } //------------------------------------------------------------------------------ -inline XMVECTOR XM_CALLCONV operator/(FXMVECTOR V, const float S) noexcept +inline XMVECTOR XM_CALLCONV operator/(FXMVECTOR V, float const S) noexcept { XMVECTOR vS = XMVectorReplicate(S); return XMVectorDivide(V, vS); diff --git a/Inc/DirectXPackedVector.h b/Inc/DirectXPackedVector.h index dd10296..a830110 100644 --- a/Inc/DirectXPackedVector.h +++ b/Inc/DirectXPackedVector.h @@ -71,7 +71,7 @@ namespace DirectX operator uint32_t() const noexcept { return c; } - XMCOLOR& operator=(const uint32_t Color) noexcept + XMCOLOR& operator=(uint32_t const Color) noexcept { c = Color; return *this; diff --git a/Inc/DirectXPackedVector.inl b/Inc/DirectXPackedVector.inl index ac67327..064aa5f 100644 --- a/Inc/DirectXPackedVector.inl +++ b/Inc/DirectXPackedVector.inl @@ -88,7 +88,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt _Analysis_assume_(OutputStride >= sizeof(float)); #if defined(_XM_F16C_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) - auto pHalf = reinterpret_cast(pInputStream); + auto pHalf = reinterpret_cast(pInputStream); auto pFloat = reinterpret_cast(pOutputStream); size_t i = 0; @@ -104,7 +104,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt // Packed input, aligned & packed output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -119,7 +119,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -135,7 +135,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128i HV = _mm_loadl_epi64(reinterpret_cast(pHalf)); + __m128i HV = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pHalf)); pHalf += InputStride * 4; __m128 FV = _mm_cvtph_ps(HV); @@ -253,7 +253,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) && (defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64) || defined(_M_ARM64EC) || __aarch64__) \ && !defined(_XM_NO_INTRINSICS_) && (!defined(__GNUC__) || (__ARM_FP & 2)) - auto pHalf = reinterpret_cast(pInputStream); + auto pHalf = reinterpret_cast(pInputStream); auto pFloat = reinterpret_cast(pOutputStream); size_t i = 0; @@ -267,7 +267,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt // Packed input, packed output for (size_t j = 0; j < four; ++j) { - uint16x4_t vHalf = vld1_u16(reinterpret_cast(pHalf)); + uint16x4_t vHalf = vld1_u16(reinterpret_cast(pHalf)); pHalf += InputStride * 4; float32x4_t vFloat = vcvt_f32_f16(vreinterpret_f16_u16(vHalf)); @@ -282,7 +282,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - uint16x4_t vHalf = vld1_u16(reinterpret_cast(pHalf)); + uint16x4_t vHalf = vld1_u16(reinterpret_cast(pHalf)); pHalf += InputStride * 4; float32x4_t vFloat = vcvt_f32_f16(vreinterpret_f16_u16(vHalf)); @@ -364,7 +364,7 @@ _Use_decl_annotations_ inline float* XMConvertHalfToFloatStream(float* pOutputSt return pOutputStream; #else - auto pHalf = reinterpret_cast(pInputStream); + auto pHalf = reinterpret_cast(pInputStream); auto pFloat = reinterpret_cast(pOutputStream); for (size_t i = 0; i < HalfCount; i++) @@ -429,7 +429,7 @@ inline HALF XMConvertFloatToHalf(float Value) noexcept //------------------------------------------------------------------------------ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStream, size_t OutputStride, - const float* pInputStream, + float const* pInputStream, size_t InputStride, size_t FloatCount) noexcept { @@ -443,7 +443,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre _Analysis_assume_(OutputStride >= sizeof(HALF)); #if defined(_XM_F16C_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) - auto pFloat = reinterpret_cast(pInputStream); + auto pFloat = reinterpret_cast(pInputStream); auto pHalf = reinterpret_cast(pOutputStream); size_t i = 0; @@ -459,7 +459,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Aligned and packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, _MM_FROUND_TO_NEAREST_INT); @@ -474,7 +474,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Packed input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, _MM_FROUND_TO_NEAREST_INT); @@ -492,7 +492,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Aligned & packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_load_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, _MM_FROUND_TO_NEAREST_INT); @@ -513,7 +513,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); + __m128 FV = _mm_loadu_ps(reinterpret_cast(pFloat)); pFloat += InputStride * 4; __m128i HV = _mm_cvtps_ph(FV, _MM_FROUND_TO_NEAREST_INT); @@ -536,16 +536,16 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Scattered input, packed output for (size_t j = 0; j < four; ++j) { - __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); + __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; __m128 FV = _mm_blend_ps(FV1, FV2, 0x2); @@ -564,16 +564,16 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Scattered input, scattered output for (size_t j = 0; j < four; ++j) { - __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); + __m128 FV1 = _mm_load_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV2 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV3 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; - __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); + __m128 FV4 = _mm_broadcast_ss(reinterpret_cast(pFloat)); pFloat += InputStride; __m128 FV = _mm_blend_ps(FV1, FV2, 0x2); @@ -597,7 +597,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre for (; i < FloatCount; ++i) { - *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); + *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); pFloat += InputStride; pHalf += OutputStride; } @@ -605,7 +605,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre return pOutputStream; #elif defined(_XM_ARM_NEON_INTRINSICS_) && (defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64) || defined(_M_ARM64EC) || __aarch64__) \ && !defined(_XM_NO_INTRINSICS_) && (!defined(__GNUC__) || (__ARM_FP & 2)) - auto pFloat = reinterpret_cast(pInputStream); + auto pFloat = reinterpret_cast(pInputStream); auto pHalf = reinterpret_cast(pOutputStream); size_t i = 0; @@ -619,7 +619,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Packed input, packed output for (size_t j = 0; j < four; ++j) { - float32x4_t vFloat = vld1q_f32(reinterpret_cast(pFloat)); + float32x4_t vFloat = vld1q_f32(reinterpret_cast(pFloat)); pFloat += InputStride * 4; uint16x4_t vHalf = vreinterpret_u16_f16(vcvt_f16_f32(vFloat)); @@ -634,7 +634,7 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre // Packed input, scattered output for (size_t j = 0; j < four; ++j) { - float32x4_t vFloat = vld1q_f32(reinterpret_cast(pFloat)); + float32x4_t vFloat = vld1q_f32(reinterpret_cast(pFloat)); pFloat += InputStride * 4; uint16x4_t vHalf = vreinterpret_u16_f16(vcvt_f16_f32(vFloat)); @@ -657,16 +657,16 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre for (size_t j = 0; j < four; ++j) { float32x4_t vFloat = vdupq_n_f32(0); - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 0); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 0); pFloat += InputStride; - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 1); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 1); pFloat += InputStride; - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 2); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 2); pFloat += InputStride; - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 3); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 3); pFloat += InputStride; uint16x4_t vHalf = vreinterpret_u16_f16(vcvt_f16_f32(vFloat)); @@ -682,16 +682,16 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre for (size_t j = 0; j < four; ++j) { float32x4_t vFloat = vdupq_n_f32(0); - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 0); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 0); pFloat += InputStride; - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 1); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 1); pFloat += InputStride; - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 2); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 2); pFloat += InputStride; - vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 3); + vFloat = vld1q_lane_f32(reinterpret_cast(pFloat), vFloat, 3); pFloat += InputStride; uint16x4_t vHalf = vreinterpret_u16_f16(vcvt_f16_f32(vFloat)); @@ -711,19 +711,19 @@ _Use_decl_annotations_ inline HALF* XMConvertFloatToHalfStream(HALF* pOutputStre for (; i < FloatCount; ++i) { - *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); + *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); pFloat += InputStride; pHalf += OutputStride; } return pOutputStream; #else - auto pFloat = reinterpret_cast(pInputStream); + auto pFloat = reinterpret_cast(pInputStream); auto pHalf = reinterpret_cast(pOutputStream); for (size_t i = 0; i < FloatCount; i++) { - *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); + *reinterpret_cast(pHalf) = XMConvertFloatToHalf(reinterpret_cast(pFloat)[0]); pFloat += InputStride; pHalf += OutputStride; } @@ -787,7 +787,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadHalf2(const XMHALF2* pS { assert(pSource); #if defined(_XM_F16C_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) - __m128 V = _mm_load_ss(reinterpret_cast(pSource)); + __m128 V = _mm_load_ss(reinterpret_cast(pSource)); return _mm_cvtph_ps(_mm_castps_si128(V)); #else XMVECTORF32 vResult = { { { XMConvertHalfToFloat(pSource->x), XMConvertHalfToFloat(pSource->y), 0.0f, 0.0f } } }; @@ -806,7 +806,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadShortN2(const XMSHORTN2 0.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); int32x4_t vInt = vmovl_s16(vreinterpret_s16_u32(vInt16)); vInt = vandq_s32(vInt, g_XMMaskXY); float32x4_t R = vcvtq_f32_s32(vInt); @@ -815,7 +815,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadShortN2(const XMSHORTN2 #elif defined(_XM_SSE_INTRINSICS_) // Splat the two shorts in all four entries (WORD alignment okay, // DWORD alignment preferred) - __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 vTemp = _mm_and_ps(vTemp, g_XMMaskX16Y16); // x needs to be sign extended @@ -839,14 +839,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadShort2(const XMSHORT2* XMVECTORF32 vResult = { { { static_cast(pSource->x), static_cast(pSource->y), 0.f, 0.f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); int32x4_t vInt = vmovl_s16(vreinterpret_s16_u32(vInt16)); vInt = vandq_s32(vInt, g_XMMaskXY); return vcvtq_f32_s32(vInt); #elif defined(_XM_SSE_INTRINSICS_) // Splat the two shorts in all four entries (WORD alignment okay, // DWORD alignment preferred) - __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 vTemp = _mm_and_ps(vTemp, g_XMMaskX16Y16); // x needs to be sign extended @@ -868,7 +868,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShortN2(const XMUSHORT XMVECTORF32 vResult = { { { static_cast(pSource->x) / 65535.0f, static_cast(pSource->y) / 65535.0f, 0.f, 0.f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); uint32x4_t vInt = vmovl_u16(vreinterpret_u16_u32(vInt16)); vInt = vandq_u32(vInt, g_XMMaskXY); float32x4_t R = vcvtq_f32_u32(vInt); @@ -879,7 +879,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShortN2(const XMUSHORT static const XMVECTORF32 FixaddY16 = { { { 0, 32768.0f * 65536.0f, 0, 0 } } }; // Splat the two shorts in all four entries (WORD alignment okay, // DWORD alignment preferred) - __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 vTemp = _mm_and_ps(vTemp, g_XMMaskX16Y16); // y needs to be sign flipped @@ -902,7 +902,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShort2(const XMUSHORT2 XMVECTORF32 vResult = { { { static_cast(pSource->x), static_cast(pSource->y), 0.f, 0.f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt16 = vld1_dup_u32(reinterpret_cast(pSource)); uint32x4_t vInt = vmovl_u16(vreinterpret_u16_u32(vInt16)); vInt = vandq_u32(vInt, g_XMMaskXY); return vcvtq_f32_u32(vInt); @@ -910,7 +910,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShort2(const XMUSHORT2 static const XMVECTORF32 FixaddY16 = { { { 0, 32768.0f, 0, 0 } } }; // Splat the two shorts in all four entries (WORD alignment okay, // DWORD alignment preferred) - __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 vTemp = _mm_and_ps(vTemp, g_XMMaskX16Y16); // y needs to be sign flipped @@ -936,7 +936,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadByteN2(const XMBYTEN2* 0.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); int16x8_t vInt16 = vmovl_s8(vreinterpret_s8_u16(vInt8)); int32x4_t vInt = vmovl_s16(vget_low_s16(vInt16)); vInt = vandq_s32(vInt, g_XMMaskXY); @@ -972,7 +972,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadByte2(const XMBYTE2* pS XMVECTORF32 vResult = { { { static_cast(pSource->x), static_cast(pSource->y), 0.0f, 0.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); int16x8_t vInt16 = vmovl_s8(vreinterpret_s8_u16(vInt8)); int32x4_t vInt = vmovl_s16(vget_low_s16(vInt16)); vInt = vandq_s32(vInt, g_XMMaskXY); @@ -1005,7 +1005,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUByteN2(const XMUBYTEN2 = { { { static_cast(pSource->x) * (1.0f / 255.0f), static_cast(pSource->y) * (1.0f / 255.0f), 0.0f, 0.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); uint16x8_t vInt16 = vmovl_u8(vreinterpret_u8_u16(vInt8)); uint32x4_t vInt = vmovl_u16(vget_low_u16(vInt16)); vInt = vandq_u32(vInt, g_XMMaskXY); @@ -1038,7 +1038,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUByte2(const XMUBYTE2* XMVECTORF32 vResult = { { { static_cast(pSource->x), static_cast(pSource->y), 0.0f, 0.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt8 = vld1_dup_u16(reinterpret_cast(pSource)); uint16x8_t vInt16 = vmovl_u8(vreinterpret_u8_u16(vInt8)); uint32x4_t vInt = vmovl_u16(vget_low_u16(vInt16)); vInt = vandq_u32(vInt, g_XMMaskXY); @@ -1077,7 +1077,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadU565(const XMU565* pSou #elif defined(_XM_ARM_NEON_INTRINSICS_) static const XMVECTORI32 U565And = { { { 0x1F, 0x3F << 5, 0x1F << 11, 0 } } }; static const XMVECTORF32 U565Mul = { { { 1.0f, 1.0f / 32.0f, 1.0f / 2048.f, 0 } } }; - uint16x4_t vInt16 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt16 = vld1_dup_u16(reinterpret_cast(pSource)); uint32x4_t vInt = vmovl_u16(vInt16); vInt = vandq_u32(vInt, U565And); float32x4_t R = vcvtq_f32_u32(vInt); @@ -1275,7 +1275,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadHalf4(const XMHALF4* pS { assert(pSource); #if defined(_XM_F16C_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) - __m128i V = _mm_loadl_epi64(reinterpret_cast(pSource)); + __m128i V = _mm_loadl_epi64(reinterpret_cast<__m128i const*>(pSource)); return _mm_cvtph_ps(V); #else XMVECTORF32 vResult = { { { XMConvertHalfToFloat(pSource->x), @@ -1297,14 +1297,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadShortN4(const XMSHORTN4 (pSource->w == -32768) ? -1.f : (static_cast(pSource->w) * (1.0f / 32767.0f)) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - int16x4_t vInt = vld1_s16(reinterpret_cast(pSource)); + int16x4_t vInt = vld1_s16(reinterpret_cast(pSource)); int32x4_t V = vmovl_s16(vInt); float32x4_t vResult = vcvtq_f32_s32(V); vResult = vmulq_n_f32(vResult, 1.0f / 32767.0f); return vmaxq_f32(vResult, vdupq_n_f32(-1.f)); #elif defined(_XM_SSE_INTRINSICS_) // Splat the color in all four entries (x,z,y,w) - __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 __m128 vTemp = _mm_and_ps(_mm_castpd_ps(vIntd), g_XMMaskX16Y16Z16W16); // x and z are unsigned! Flip the bits to convert the order to signed @@ -1333,12 +1333,12 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadShort4(const XMSHORT4* static_cast(pSource->w) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - int16x4_t vInt = vld1_s16(reinterpret_cast(pSource)); + int16x4_t vInt = vld1_s16(reinterpret_cast(pSource)); int32x4_t V = vmovl_s16(vInt); return vcvtq_f32_s32(V); #elif defined(_XM_SSE_INTRINSICS_) // Splat the color in all four entries (x,z,y,w) - __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 __m128 vTemp = _mm_and_ps(_mm_castpd_ps(vIntd), g_XMMaskX16Y16Z16W16); // x and z are unsigned! Flip the bits to convert the order to signed @@ -1365,7 +1365,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShortN4(const XMUSHORT static_cast(pSource->w) / 65535.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint16x4_t vInt = vld1_u16(reinterpret_cast(pSource)); + uint16x4_t vInt = vld1_u16(reinterpret_cast(pSource)); uint32x4_t V = vmovl_u16(vInt); float32x4_t vResult = vcvtq_f32_u32(V); return vmulq_n_f32(vResult, 1.0f / 65535.0f); @@ -1374,7 +1374,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShortN4(const XMUSHORT = { { { 1.0f / 65535.0f, 1.0f / 65535.0f, 1.0f / (65535.0f * 65536.0f), 1.0f / (65535.0f * 65536.0f) } } }; static const XMVECTORF32 FixaddY16W16 = { { { 0, 0, 32768.0f * 65536.0f, 32768.0f * 65536.0f } } }; // Splat the color in all four entries (x,z,y,w) - __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 __m128 vTemp = _mm_and_ps(_mm_castpd_ps(vIntd), g_XMMaskX16Y16Z16W16); // y and w are signed! Flip the bits to convert the order to unsigned @@ -1401,13 +1401,13 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUShort4(const XMUSHORT4 static_cast(pSource->w) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint16x4_t vInt = vld1_u16(reinterpret_cast(pSource)); + uint16x4_t vInt = vld1_u16(reinterpret_cast(pSource)); uint32x4_t V = vmovl_u16(vInt); return vcvtq_f32_u32(V); #elif defined(_XM_SSE_INTRINSICS_) static const XMVECTORF32 FixaddY16W16 = { { { 0, 0, 32768.0f, 32768.0f } } }; // Splat the color in all four entries (x,z,y,w) - __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 __m128 vTemp = _mm_and_ps(_mm_castpd_ps(vIntd), g_XMMaskX16Y16Z16W16); // y and w are signed! Flip the bits to convert the order to unsigned @@ -1428,7 +1428,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadXDecN4(const XMXDECN4* { assert(pSource); #if defined(_XM_NO_INTRINSICS_) - static const uint32_t SignExtend[] = { 0x00000000, 0xFFFFFC00 }; + static uint32_t const SignExtend[] = { 0x00000000, 0xFFFFFC00 }; uint32_t ElementX = pSource->v & 0x3FF; uint32_t ElementY = (pSource->v >> 10) & 0x3FF; @@ -1441,7 +1441,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadXDecN4(const XMXDECN4* static_cast(pSource->v >> 30) / 3.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskA2B10G10R10); vInt = veorq_u32(vInt, g_XMFlipA2B10G10R10); float32x4_t R = vcvtq_f32_s32(vreinterpretq_s32_u32(vInt)); @@ -1450,7 +1450,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadXDecN4(const XMXDECN4* return vmaxq_f32(R, vdupq_n_f32(-1.0f)); #elif defined(_XM_SSE_INTRINSICS_) // Splat the color in all four entries - __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 vTemp = _mm_and_ps(vTemp, g_XMMaskA2B10G10R10); // a is unsigned! Flip the bit to convert the order to signed @@ -1487,7 +1487,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadXDec4(const XMXDEC4* pS { assert(pSource); #if defined(_XM_NO_INTRINSICS_) - static const uint32_t SignExtend[] = { 0x00000000, 0xFFFFFC00 }; + static uint32_t const SignExtend[] = { 0x00000000, 0xFFFFFC00 }; uint32_t ElementX = pSource->v & 0x3FF; uint32_t ElementY = (pSource->v >> 10) & 0x3FF; @@ -1501,7 +1501,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadXDec4(const XMXDEC4* pS #elif defined(_XM_ARM_NEON_INTRINSICS_) static const XMVECTORU32 XDec4Xor = { { { 0x200, 0x200 << 10, 0x200 << 20, 0x80000000 } } }; static const XMVECTORF32 XDec4Add = { { { -512.0f, -512.0f * 1024.0f, -512.0f * 1024.0f * 1024.0f, 32768 * 65536.0f } } }; - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskDec4); vInt = veorq_u32(vInt, XDec4Xor); float32x4_t R = vcvtq_f32_s32(vreinterpretq_s32_u32(vInt)); @@ -1511,7 +1511,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadXDec4(const XMXDEC4* pS static const XMVECTORU32 XDec4Xor = { { { 0x200, 0x200 << 10, 0x200 << 20, 0x80000000 } } }; static const XMVECTORF32 XDec4Add = { { { -512.0f, -512.0f * 1024.0f, -512.0f * 1024.0f * 1024.0f, 32768 * 65536.0f } } }; // Splat the color in all four entries - XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 vTemp = _mm_and_ps(vTemp, g_XMMaskDec4); // a is unsigned! Flip the bit to convert the order to signed @@ -1557,7 +1557,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUDecN4(const XMUDECN4* 1.0f / (1023.0f * 1024.0f), 1.0f / (1023.0f * 1024.0f * 1024.0f), 1.0f / (3.0f * 1024.0f * 1024.0f * 1024.0f) } } }; - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskDec4); float32x4_t R = vcvtq_f32_u32(vInt); return vmulq_f32(R, UDecN4Mul); @@ -1567,7 +1567,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUDecN4(const XMUDECN4* 1.0f / (1023.0f * 1024.0f * 1024.0f), 1.0f / (3.0f * 1024.0f * 1024.0f * 1024.0f) } } }; // Splat the color in all four entries - XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 vTemp = _mm_and_ps(vTemp, g_XMMaskDec4); // a is unsigned! Flip the bit to convert the order to signed @@ -1604,7 +1604,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUDecN4_XR(const XMUDECN { { 1.0f / 510.0f, 1.0f / (510.0f * 1024.0f), 1.0f / (510.0f * 1024.0f * 1024.0f), 1.0f / (3.0f * 1024.0f * 1024.0f * 1024.0f) } } }; static const XMVECTORI32 XRBias = { { { 0x180, 0x180 * 1024, 0x180 * 1024 * 1024, 0 } } }; - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskDec4); int32x4_t vTemp = vsubq_s32(vreinterpretq_s32_u32(vInt), XRBias); vTemp = veorq_s32(vTemp, g_XMFlipW); @@ -1617,7 +1617,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUDecN4_XR(const XMUDECN }; static const XMVECTORI32 XRBias = { { { 0x180, 0x180 * 1024, 0x180 * 1024 * 1024, 0 } } }; // Splat the color in all four entries - XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Mask channels vTemp = _mm_and_ps(vTemp, g_XMMaskDec4); // Subtract bias @@ -1648,13 +1648,13 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUDec4(const XMUDEC4* pS static_cast(pSource->v >> 30) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskDec4); float32x4_t R = vcvtq_f32_u32(vInt); return vmulq_f32(R, g_XMMulDec4); #elif defined(_XM_SSE_INTRINSICS_) // Splat the color in all four entries - XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 vTemp = _mm_and_ps(vTemp, g_XMMaskDec4); // a is unsigned! Flip the bit to convert the order to signed @@ -1690,8 +1690,8 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadDecN4(const XMDECN4* pS { assert(pSource); #if defined(_XM_NO_INTRINSICS_) - static const uint32_t SignExtend[] = { 0x00000000, 0xFFFFFC00 }; - static const uint32_t SignExtendW[] = { 0x00000000, 0xFFFFFFFC }; + static uint32_t const SignExtend[] = { 0x00000000, 0xFFFFFC00 }; + static uint32_t const SignExtendW[] = { 0x00000000, 0xFFFFFFFC }; uint32_t ElementX = pSource->v & 0x3FF; uint32_t ElementY = (pSource->v >> 10) & 0x3FF; @@ -1707,7 +1707,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadDecN4(const XMDECN4* pS #elif defined(_XM_ARM_NEON_INTRINSICS_) static const XMVECTORF32 DecN4Mul = { { { 1.0f / 511.0f, 1.0f / (511.0f * 1024.0f), 1.0f / (511.0f * 1024.0f * 1024.0f), 1.0f / (1024.0f * 1024.0f * 1024.0f) } } }; - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskDec4); vInt = veorq_u32(vInt, g_XMXorDec4); float32x4_t R = vcvtq_f32_s32(vreinterpretq_s32_u32(vInt)); @@ -1718,7 +1718,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadDecN4(const XMDECN4* pS static const XMVECTORF32 DecN4Mul = { { { 1.0f / 511.0f, 1.0f / (511.0f * 1024.0f), 1.0f / (511.0f * 1024.0f * 1024.0f), 1.0f / (1024.0f * 1024.0f * 1024.0f) } } }; // Splat the color in all four entries - XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 vTemp = _mm_and_ps(vTemp, g_XMMaskDec4); // a is unsigned! Flip the bit to convert the order to signed @@ -1739,8 +1739,8 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadDec4(const XMDEC4* pSou { assert(pSource); #if defined(_XM_NO_INTRINSICS_) - static const uint32_t SignExtend[] = { 0x00000000, 0xFFFFFC00 }; - static const uint32_t SignExtendW[] = { 0x00000000, 0xFFFFFFFC }; + static uint32_t const SignExtend[] = { 0x00000000, 0xFFFFFC00 }; + static uint32_t const SignExtendW[] = { 0x00000000, 0xFFFFFFFC }; uint32_t ElementX = pSource->v & 0x3FF; uint32_t ElementY = (pSource->v >> 10) & 0x3FF; @@ -1753,7 +1753,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadDec4(const XMDEC4* pSou static_cast(static_cast(ElementW | SignExtendW[ElementW >> 1])) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); + uint32x4_t vInt = vld1q_dup_u32(reinterpret_cast(pSource)); vInt = vandq_u32(vInt, g_XMMaskDec4); vInt = veorq_u32(vInt, g_XMXorDec4); float32x4_t R = vcvtq_f32_s32(vreinterpretq_s32_u32(vInt)); @@ -1761,7 +1761,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadDec4(const XMDEC4* pSou return vmulq_f32(R, g_XMMulDec4); #elif defined(_XM_SSE_INTRINSICS_) // Splat the color in all four entries - XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 vTemp = _mm_and_ps(vTemp, g_XMMaskDec4); // a is unsigned! Flip the bit to convert the order to signed @@ -1797,7 +1797,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUByteN4(const XMUBYTEN4 static_cast(pSource->w) / 255.0f } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); uint16x8_t vInt16 = vmovl_u8(vreinterpret_u8_u32(vInt8)); uint32x4_t vInt = vmovl_u16(vget_low_u16(vInt16)); float32x4_t R = vcvtq_f32_u32(vInt); @@ -1806,7 +1806,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUByteN4(const XMUBYTEN4 static const XMVECTORF32 LoadUByteN4Mul = { { { 1.0f / 255.0f, 1.0f / (255.0f * 256.0f), 1.0f / (255.0f * 65536.0f), 1.0f / (255.0f * 65536.0f * 256.0f) } } }; // Splat the color in all four entries (x,z,y,w) - XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 vTemp = _mm_and_ps(vTemp, g_XMMaskByte4); // w is signed! Flip the bits to convert the order to unsigned @@ -1832,14 +1832,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUByte4(const XMUBYTE4* static_cast(pSource->w) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); uint16x8_t vInt16 = vmovl_u8(vreinterpret_u8_u32(vInt8)); uint32x4_t vInt = vmovl_u16(vget_low_u16(vInt16)); return vcvtq_f32_u32(vInt); #elif defined(_XM_SSE_INTRINSICS_) static const XMVECTORF32 LoadUByte4Mul = { { { 1.0f, 1.0f / 256.0f, 1.0f / 65536.0f, 1.0f / (65536.0f * 256.0f) } } }; // Splat the color in all four entries (x,z,y,w) - XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 vTemp = _mm_and_ps(vTemp, g_XMMaskByte4); // w is signed! Flip the bits to convert the order to unsigned @@ -1865,7 +1865,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadByteN4(const XMBYTEN4* (pSource->w == -128) ? -1.f : (static_cast(pSource->w) / 127.0f) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); int16x8_t vInt16 = vmovl_s8(vreinterpret_s8_u32(vInt8)); int32x4_t vInt = vmovl_s16(vget_low_s16(vInt16)); float32x4_t R = vcvtq_f32_s32(vInt); @@ -1875,7 +1875,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadByteN4(const XMBYTEN4* static const XMVECTORF32 LoadByteN4Mul = { { { 1.0f / 127.0f, 1.0f / (127.0f * 256.0f), 1.0f / (127.0f * 65536.0f), 1.0f / (127.0f * 65536.0f * 256.0f) } } }; // Splat the color in all four entries (x,z,y,w) - XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 vTemp = _mm_and_ps(vTemp, g_XMMaskByte4); // x,y and z are unsigned! Flip the bits to convert the order to signed @@ -1902,14 +1902,14 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadByte4(const XMBYTE4* pS static_cast(pSource->w) } } }; return vResult.v; #elif defined(_XM_ARM_NEON_INTRINSICS_) - uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); + uint32x2_t vInt8 = vld1_dup_u32(reinterpret_cast(pSource)); int16x8_t vInt16 = vmovl_s8(vreinterpret_s8_u32(vInt8)); int32x4_t vInt = vmovl_s16(vget_low_s16(vInt16)); return vcvtq_f32_s32(vInt); #elif defined(_XM_SSE_INTRINSICS_) static const XMVECTORF32 LoadByte4Mul = { { { 1.0f, 1.0f / 256.0f, 1.0f / 65536.0f, 1.0f / (65536.0f * 256.0f) } } }; // Splat the color in all four entries (x,z,y,w) - XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 vTemp = _mm_and_ps(vTemp, g_XMMaskByte4); // x,y and z are unsigned! Flip the bits to convert the order to signed @@ -1936,7 +1936,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadUNibble4(const XMUNIBBL #elif defined(_XM_ARM_NEON_INTRINSICS_) static const XMVECTORI32 UNibble4And = { { { 0xF, 0xF0, 0xF00, 0xF000 } } }; static const XMVECTORF32 UNibble4Mul = { { { 1.0f, 1.0f / 16.f, 1.0f / 256.f, 1.0f / 4096.f } } }; - uint16x4_t vInt16 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt16 = vld1_dup_u16(reinterpret_cast(pSource)); uint32x4_t vInt = vmovl_u16(vInt16); vInt = vandq_u32(vInt, UNibble4And); float32x4_t R = vcvtq_f32_u32(vInt); @@ -1969,7 +1969,7 @@ _Use_decl_annotations_ inline XMVECTOR XM_CALLCONV XMLoadU555(const XMU555* pSou #elif defined(_XM_ARM_NEON_INTRINSICS_) static const XMVECTORI32 U555And = { { { 0x1F, 0x1F << 5, 0x1F << 10, 0x8000 } } }; static const XMVECTORF32 U555Mul = { { { 1.0f, 1.0f / 32.f, 1.0f / 1024.f, 1.0f / 32768.f } } }; - uint16x4_t vInt16 = vld1_dup_u16(reinterpret_cast(pSource)); + uint16x4_t vInt16 = vld1_dup_u16(reinterpret_cast(pSource)); uint32x4_t vInt = vmovl_u16(vInt16); vInt = vandq_u32(vInt, U555And); float32x4_t R = vcvtq_f32_u32(vInt); @@ -2539,10 +2539,10 @@ _Use_decl_annotations_ inline void XM_CALLCONV XMStoreFloat3SE(XMFLOAT3SE* pDest float y = (tmp.y >= 0.f) ? ((tmp.y > maxf9) ? maxf9 : tmp.y) : 0.f; float z = (tmp.z >= 0.f) ? ((tmp.z > maxf9) ? maxf9 : tmp.z) : 0.f; - const float max_xy = (x > y) ? x : y; - const float max_xyz = (max_xy > z) ? max_xy : z; + float const max_xy = (x > y) ? x : y; + float const max_xyz = (max_xy > z) ? max_xy : z; - const float maxColor = (max_xyz > minf9) ? max_xyz : minf9; + float const maxColor = (max_xyz > minf9) ? max_xyz : minf9; union { @@ -3617,7 +3617,7 @@ inline XMCOLOR::XMCOLOR(float _r, float _g, float _b, float _a) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMCOLOR::XMCOLOR(const float* pArray) noexcept +_Use_decl_annotations_ inline XMCOLOR::XMCOLOR(float const* pArray) noexcept { XMStoreColor(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -3637,7 +3637,7 @@ inline XMHALF2::XMHALF2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMHALF2::XMHALF2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMHALF2::XMHALF2(float const* pArray) noexcept { assert(pArray != nullptr); x = XMConvertFloatToHalf(pArray[0]); @@ -3658,7 +3658,7 @@ inline XMSHORTN2::XMSHORTN2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMSHORTN2::XMSHORTN2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMSHORTN2::XMSHORTN2(float const* pArray) noexcept { XMStoreShortN2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3677,7 +3677,7 @@ inline XMSHORT2::XMSHORT2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMSHORT2::XMSHORT2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMSHORT2::XMSHORT2(float const* pArray) noexcept { XMStoreShort2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3696,7 +3696,7 @@ inline XMUSHORTN2::XMUSHORTN2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUSHORTN2::XMUSHORTN2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUSHORTN2::XMUSHORTN2(float const* pArray) noexcept { XMStoreUShortN2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3715,7 +3715,7 @@ inline XMUSHORT2::XMUSHORT2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUSHORT2::XMUSHORT2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUSHORT2::XMUSHORT2(float const* pArray) noexcept { XMStoreUShort2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3734,7 +3734,7 @@ inline XMBYTEN2::XMBYTEN2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMBYTEN2::XMBYTEN2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMBYTEN2::XMBYTEN2(float const* pArray) noexcept { XMStoreByteN2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3753,7 +3753,7 @@ inline XMBYTE2::XMBYTE2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMBYTE2::XMBYTE2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMBYTE2::XMBYTE2(float const* pArray) noexcept { XMStoreByte2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3772,7 +3772,7 @@ inline XMUBYTEN2::XMUBYTEN2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUBYTEN2::XMUBYTEN2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUBYTEN2::XMUBYTEN2(float const* pArray) noexcept { XMStoreUByteN2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3791,7 +3791,7 @@ inline XMUBYTE2::XMUBYTE2(float _x, float _y) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUBYTE2::XMUBYTE2(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUBYTE2::XMUBYTE2(float const* pArray) noexcept { XMStoreUByte2(this, XMLoadFloat2(reinterpret_cast(pArray))); } @@ -3807,7 +3807,7 @@ inline XMU565::XMU565(float _x, float _y, float _z) noexcept XMStoreU565(this, XMVectorSet(_x, _y, _z, 0.0f)); } -_Use_decl_annotations_ inline XMU565::XMU565(const float* pArray) noexcept +_Use_decl_annotations_ inline XMU565::XMU565(float const* pArray) noexcept { XMStoreU565(this, XMLoadFloat3(reinterpret_cast(pArray))); } @@ -3823,7 +3823,7 @@ inline XMFLOAT3PK::XMFLOAT3PK(float _x, float _y, float _z) noexcept XMStoreFloat3PK(this, XMVectorSet(_x, _y, _z, 0.0f)); } -_Use_decl_annotations_ inline XMFLOAT3PK::XMFLOAT3PK(const float* pArray) noexcept +_Use_decl_annotations_ inline XMFLOAT3PK::XMFLOAT3PK(float const* pArray) noexcept { XMStoreFloat3PK(this, XMLoadFloat3(reinterpret_cast(pArray))); } @@ -3839,7 +3839,7 @@ inline XMFLOAT3SE::XMFLOAT3SE(float _x, float _y, float _z) noexcept XMStoreFloat3SE(this, XMVectorSet(_x, _y, _z, 0.0f)); } -_Use_decl_annotations_ inline XMFLOAT3SE::XMFLOAT3SE(const float* pArray) noexcept +_Use_decl_annotations_ inline XMFLOAT3SE::XMFLOAT3SE(float const* pArray) noexcept { XMStoreFloat3SE(this, XMLoadFloat3(reinterpret_cast(pArray))); } @@ -3862,7 +3862,7 @@ inline XMHALF4::XMHALF4(float _x, float _y, float _z, float _w) noexcept //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMHALF4::XMHALF4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMHALF4::XMHALF4(float const* pArray) noexcept { XMConvertFloatToHalfStream(&x, sizeof(HALF), pArray, sizeof(float), 4); } @@ -3881,7 +3881,7 @@ inline XMSHORTN4::XMSHORTN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMSHORTN4::XMSHORTN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMSHORTN4::XMSHORTN4(float const* pArray) noexcept { XMStoreShortN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -3900,7 +3900,7 @@ inline XMSHORT4::XMSHORT4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMSHORT4::XMSHORT4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMSHORT4::XMSHORT4(float const* pArray) noexcept { XMStoreShort4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -3919,7 +3919,7 @@ inline XMUSHORTN4::XMUSHORTN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUSHORTN4::XMUSHORTN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUSHORTN4::XMUSHORTN4(float const* pArray) noexcept { XMStoreUShortN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -3938,7 +3938,7 @@ inline XMUSHORT4::XMUSHORT4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUSHORT4::XMUSHORT4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUSHORT4::XMUSHORT4(float const* pArray) noexcept { XMStoreUShort4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -3957,7 +3957,7 @@ inline XMXDECN4::XMXDECN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMXDECN4::XMXDECN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMXDECN4::XMXDECN4(float const* pArray) noexcept { XMStoreXDecN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -3991,7 +3991,7 @@ inline XMXDEC4::XMXDEC4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMXDEC4::XMXDEC4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMXDEC4::XMXDEC4(float const* pArray) noexcept { XMStoreXDec4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4010,7 +4010,7 @@ inline XMDECN4::XMDECN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMDECN4::XMDECN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMDECN4::XMDECN4(float const* pArray) noexcept { XMStoreDecN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4029,7 +4029,7 @@ inline XMDEC4::XMDEC4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMDEC4::XMDEC4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMDEC4::XMDEC4(float const* pArray) noexcept { XMStoreDec4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4058,7 +4058,7 @@ inline XMUDECN4::XMUDECN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUDECN4::XMUDECN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUDECN4::XMUDECN4(float const* pArray) noexcept { XMStoreUDecN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4077,7 +4077,7 @@ inline XMUDEC4::XMUDEC4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUDEC4::XMUDEC4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUDEC4::XMUDEC4(float const* pArray) noexcept { XMStoreUDec4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4096,7 +4096,7 @@ inline XMBYTEN4::XMBYTEN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMBYTEN4::XMBYTEN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMBYTEN4::XMBYTEN4(float const* pArray) noexcept { XMStoreByteN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4115,7 +4115,7 @@ inline XMBYTE4::XMBYTE4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMBYTE4::XMBYTE4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMBYTE4::XMBYTE4(float const* pArray) noexcept { XMStoreByte4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4134,7 +4134,7 @@ inline XMUBYTEN4::XMUBYTEN4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUBYTEN4::XMUBYTEN4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUBYTEN4::XMUBYTEN4(float const* pArray) noexcept { XMStoreUByteN4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4153,7 +4153,7 @@ inline XMUBYTE4::XMUBYTE4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUBYTE4::XMUBYTE4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUBYTE4::XMUBYTE4(float const* pArray) noexcept { XMStoreUByte4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4172,7 +4172,7 @@ inline XMUNIBBLE4::XMUNIBBLE4(float _x, float _y, float _z, float _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMUNIBBLE4::XMUNIBBLE4(const float* pArray) noexcept +_Use_decl_annotations_ inline XMUNIBBLE4::XMUNIBBLE4(float const* pArray) noexcept { XMStoreUNibble4(this, XMLoadFloat4(reinterpret_cast(pArray))); } @@ -4191,7 +4191,7 @@ inline XMU555::XMU555(float _x, float _y, float _z, bool _w) noexcept } //------------------------------------------------------------------------------ -_Use_decl_annotations_ inline XMU555::XMU555(const float* pArray, bool _w) noexcept +_Use_decl_annotations_ inline XMU555::XMU555(float const* pArray, bool _w) noexcept { XMVECTOR V = XMLoadFloat3(reinterpret_cast(pArray)); XMStoreU555(this, XMVectorSetW(V, ((_w) ? 1.0f : 0.0f))); diff --git a/SHMath/DirectXSH.cpp b/SHMath/DirectXSH.cpp index c457ba5..2b8c9b0 100644 --- a/SHMath/DirectXSH.cpp +++ b/SHMath/DirectXSH.cpp @@ -34,7 +34,7 @@ namespace #pragma prefast(disable : 246, "generated code by maple (nested const variable definitions)") #endif - const float fExtraNormFac[XM_SH_MAXORDER] = { 2.0f * sqrtf(XM_PI), + float const fExtraNormFac[XM_SH_MAXORDER] = { 2.0f * sqrtf(XM_PI), 2.0f / 3.0f * sqrtf(3.0f * XM_PI), 2.0f / 5.0f * sqrtf(5.0f * XM_PI), 2.0f / 7.0f * sqrtf(7.0f * XM_PI), @@ -45,31 +45,31 @@ namespace // extent. No error checking - only used internaly. This function // only returns the Yl0 coefficients, since the rest are zero for // circularly symmetric functions. - const float ComputeCapInt_t1 = sqrtf(0.3141593E1f); - const float ComputeCapInt_t5 = sqrtf(3.0f); - const float ComputeCapInt_t11 = sqrtf(5.0f); - const float ComputeCapInt_t18 = sqrtf(7.0f); - const float ComputeCapInt_t32 = sqrtf(11.0f); + float const ComputeCapInt_t1 = sqrtf(0.3141593E1f); + float const ComputeCapInt_t5 = sqrtf(3.0f); + float const ComputeCapInt_t11 = sqrtf(5.0f); + float const ComputeCapInt_t18 = sqrtf(7.0f); + float const ComputeCapInt_t32 = sqrtf(11.0f); - inline void ComputeCapInt(const size_t order, float angle, float* pR) + inline void ComputeCapInt(size_t const order, float angle, float* pR) { - const float t2 = cosf(angle); - const float t3 = ComputeCapInt_t1 * t2; - const float t7 = sinf(angle); - const float t8 = t7 * t7; + float const t2 = cosf(angle); + float const t3 = ComputeCapInt_t1 * t2; + float const t7 = sinf(angle); + float const t8 = t7 * t7; pR[0] = -t3 + ComputeCapInt_t1; pR[1] = ComputeCapInt_t5 * ComputeCapInt_t1 * t8 / 2.0f; if (order > 2) { - const float t13 = t2 * t2; + float const t13 = t2 * t2; pR[2] = -ComputeCapInt_t11 * ComputeCapInt_t1 * t2 * (t13 - 1.0f) / 2.0f; if (order > 3) { - const float t19 = ComputeCapInt_t18 * ComputeCapInt_t1; - const float t20 = t13 * t13; + float const t19 = ComputeCapInt_t18 * ComputeCapInt_t1; + float const t20 = t13 * t13; pR[3] = -5.0f / 8.0f * t19 * t20 + 3.0f / 4.0f * t19 * t13 - t19 / 8.0f; if (order > 4) @@ -78,7 +78,7 @@ namespace pR[4] = -3.0f / 8.0f * t3 * (7.0f * t20 - 10.0f * t13 + 3.0f); if (order > 5) { - const float t33 = ComputeCapInt_t32 * ComputeCapInt_t1; + float const t33 = ComputeCapInt_t32 * ComputeCapInt_t1; pR[5] = -21.0f / 16.0f * t33 * t20 * t13 + 35.0f / 16.0f * t33 * t20 - 15.0f / 16.0f * t33 * t13 + t33 / 16.0f; } } @@ -88,13 +88,13 @@ namespace // input pF only consists of Yl0 values, normalizes coefficients for directional // lights. - inline float CosWtInt(const size_t order) + inline float CosWtInt(size_t const order) { - const float fCW0 = 0.25f; - const float fCW1 = 0.5f; - const float fCW2 = 5.0f / 16.0f; + float const fCW0 = 0.25f; + float const fCW1 = 0.5f; + float const fCW2 = 5.0f / 16.0f; // const float fCW3 = 0.0f; - const float fCW4 = -3.0f / 32.0f; + float const fCW4 = -3.0f / 32.0f; // const float fCW5 = 0.0f; // order has to be at least linear... @@ -111,8 +111,8 @@ namespace return fRet; } - const float SHEvalHemisphereLight_fSqrtPi = sqrtf(XM_PI); - const float SHEvalHemisphereLight_fSqrtPi3 = sqrtf(XM_PI / 3.0f); + float const SHEvalHemisphereLight_fSqrtPi = sqrtf(XM_PI); + float const SHEvalHemisphereLight_fSqrtPi3 = sqrtf(XM_PI / 3.0f); using REAL = float; #define CONSTANT(x) (x##f) @@ -467,26 +467,26 @@ namespace const REAL M_PIjs = (REAL)(4.0 * atan(1.0)); const REAL maxang = (REAL)(M_PIjs / 2); - const int NSH0 = 1; - const int NSH1 = 4; - const int NSH2 = 9; - const int NSH3 = 16; - const int NSH4 = 25; - const int NSH5 = 36; - const int NSH6 = 49; - const int NSH7 = 64; - const int NSH8 = 81; - const int NSH9 = 100; - const int NL0 = 1; - const int NL1 = 3; - const int NL2 = 5; - const int NL3 = 7; - const int NL4 = 9; - const int NL5 = 11; - const int NL6 = 13; - const int NL7 = 15; - const int NL8 = 17; - const int NL9 = 19; + int const NSH0 = 1; + int const NSH1 = 4; + int const NSH2 = 9; + int const NSH3 = 16; + int const NSH4 = 25; + int const NSH5 = 36; + int const NSH6 = 49; + int const NSH7 = 64; + int const NSH8 = 81; + int const NSH9 = 100; + int const NL0 = 1; + int const NL1 = 3; + int const NL2 = 5; + int const NL3 = 7; + int const NL4 = 9; + int const NL5 = 11; + int const NL6 = 13; + int const NL7 = 15; + int const NL8 = 17; + int const NL9 = 19; inline void rot(REAL ct, REAL st, REAL x, REAL y, REAL& xout, REAL& yout) { @@ -954,7 +954,7 @@ namespace } // simple matrix vector multiply for a square matrix (only used by ZRotation) - inline void SimpMatMul(size_t dim, const float* matrix, const float* input, float* result) + inline void SimpMatMul(size_t dim, float const* matrix, float const* input, float* result) { for (size_t iR = 0; iR < dim; ++iR) { @@ -981,9 +981,9 @@ _Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHEvalDirection(float* resu XMFLOAT4A dv; XMStoreFloat4A(&dv, dir); - const float fX = dv.x; - const float fY = dv.y; - const float fZ = dv.z; + float const fX = dv.x; + float const fY = dv.y; + float const fZ = dv.z; switch (order) { @@ -1008,7 +1008,7 @@ _Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHEvalDirection(float* resu // // https://msdn.microsoft.com/en-us/library/windows/desktop/bb204992.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHRotate(float* result, size_t order, FXMMATRIX rotMatrix, const float* input) noexcept +_Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHRotate(float* result, size_t order, FXMMATRIX rotMatrix, float const* input) noexcept { if (!result || !input) return nullptr; @@ -1020,17 +1020,17 @@ _Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHRotate(float* result, siz XMStoreFloat3x3(&mat, rotMatrix); float mRot[3 * 3]; - const float r00 = mRot[0 * 3 + 0] = mat._11; - const float r10 = mRot[1 * 3 + 0] = mat._12; - const float r20 = mRot[2 * 3 + 0] = mat._13; + float const r00 = mRot[0 * 3 + 0] = mat._11; + float const r10 = mRot[1 * 3 + 0] = mat._12; + float const r20 = mRot[2 * 3 + 0] = mat._13; - const float r01 = mRot[0 * 3 + 1] = mat._21; - const float r11 = mRot[1 * 3 + 1] = mat._22; - const float r21 = mRot[2 * 3 + 1] = mat._23; + float const r01 = mRot[0 * 3 + 1] = mat._21; + float const r11 = mRot[1 * 3 + 1] = mat._22; + float const r21 = mRot[2 * 3 + 1] = mat._23; - const float r02 = mRot[0 * 3 + 2] = mat._31; - const float r12 = mRot[1 * 3 + 2] = mat._32; - const float r22 = mRot[2 * 3 + 2] = mat._33; + float const r02 = mRot[0 * 3 + 2] = mat._31; + float const r12 = mRot[1 * 3 + 2] = mat._32; + float const r22 = mRot[2 * 3 + 2] = mat._33; result[0] = input[0]; // rotate the constant term @@ -1055,27 +1055,27 @@ _Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHRotate(float* result, siz // direct code for quadratics is faster than ZYZ reccurence relations - const float t41 = r01 * r00; - const float t43 = r11 * r10; - const float t48 = r11 * r12; - const float t50 = r01 * r02; - const float t55 = r02 * r02; - const float t57 = r22 * r22; - const float t58 = r12 * r12; - const float t61 = r00 * r02; - const float t63 = r10 * r12; - const float t68 = r10 * r10; - const float t70 = r01 * r01; - const float t72 = r11 * r11; - const float t74 = r00 * r00; - const float t76 = r21 * r21; - const float t78 = r20 * r20; - - const float v173 = 0.1732050808e1f; - const float v577 = 0.5773502693e0f; - const float v115 = 0.1154700539e1f; - const float v288 = 0.2886751347e0f; - const float v866 = 0.8660254040e0f; + float const t41 = r01 * r00; + float const t43 = r11 * r10; + float const t48 = r11 * r12; + float const t50 = r01 * r02; + float const t55 = r02 * r02; + float const t57 = r22 * r22; + float const t58 = r12 * r12; + float const t61 = r00 * r02; + float const t63 = r10 * r12; + float const t68 = r10 * r10; + float const t70 = r01 * r01; + float const t72 = r11 * r11; + float const t74 = r00 * r00; + float const t76 = r21 * r21; + float const t78 = r20 * r20; + + float const v173 = 0.1732050808e1f; + float const v577 = 0.5773502693e0f; + float const v115 = 0.1154700539e1f; + float const v288 = 0.2886751347e0f; + float const v866 = 0.8660254040e0f; R[0] = r11 * r00 + r01 * r10; R[1] = -r01 * r12 - r11 * r02; @@ -1106,7 +1106,7 @@ _Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHRotate(float* result, siz // blow the matrix multiply out by hand, looping is ineficient on a P4... for (unsigned int iR = 0; iR < 5; iR++) { - const unsigned int uBase = iR * 5; + unsigned int const uBase = iR * 5; result[4 + iR] = R[uBase + 0] * input[4] + R[uBase + 1] * input[5] + R[uBase + 2] * input[6] + R[uBase + 3] * input[7] + R[uBase + 4] * input[8]; } @@ -1130,7 +1130,7 @@ _Use_decl_annotations_ float* XM_CALLCONV DirectX::XMSHRotate(float* result, siz // // https://msdn.microsoft.com/en-us/library/windows/desktop/bb205461.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, float angle, const float* input) noexcept +_Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, float angle, float const* input) noexcept { if (!result || !input) return nullptr; @@ -1145,11 +1145,11 @@ _Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, // these are actually very sparse matrices, most of the entries are zero's... - const float ca = cosf(angle); - const float sa = sinf(angle); + float const ca = cosf(angle); + float const sa = sinf(angle); - const float t1 = ca; - const float t2 = sa; + float const t1 = ca; + float const t2 = sa; R[0] = t1; R[1] = 0.0f; R[2] = t2; @@ -1167,12 +1167,12 @@ _Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, { for (int j = 0; j < 5 * 5; j++) R[j] = 0.0f; - const float t1 = sa; - const float t2 = t1 * t1; - const float t3 = ca; - const float t4 = t3 * t3; - const float t5 = -t2 + t4; - const float t7 = 2.0f * t3 * t1; + float const t1 = sa; + float const t2 = t1 * t1; + float const t3 = ca; + float const t4 = t3 * t3; + float const t5 = -t2 + t4; + float const t7 = 2.0f * t3 * t1; R[0] = t5; R[4] = t7; R[6] = t3; @@ -1188,14 +1188,14 @@ _Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, { for (int j = 0; j < 7 * 7; j++) R[j] = 0.0f; - const float t1 = ca; - const float t2 = t1 * t1; - const float t4 = sa; - const float t5 = t4 * t4; - const float t8 = t2 * t1 - 3.0f * t1 * t5; - const float t12 = 3.0f * t4 * t2 - t5 * t4; - const float t13 = -t5 + t2; - const float t15 = 2.0f * t1 * t4; + float const t1 = ca; + float const t2 = t1 * t1; + float const t4 = sa; + float const t5 = t4 * t4; + float const t8 = t2 * t1 - 3.0f * t1 * t5; + float const t12 = 3.0f * t4 * t2 - t5 * t4; + float const t13 = -t5 + t2; + float const t15 = 2.0f * t1 * t4; R[0] = t8; R[6] = t12; R[8] = t13; @@ -1214,20 +1214,20 @@ _Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, { for (int j = 0; j <= 9 * 9; j++) R[j] = 0.0f; - const float t1 = ca; - const float t2 = t1 * t1; - const float t3 = t2 * t2; - const float t4 = sa; - const float t5 = t4 * t4; - const float t6 = t5 * t5; - const float t9 = t3 + t6 - 6.0f * t5 * t2; - const float t10 = t5 * t4; - const float t12 = t2 * t1; - const float t14 = -t10 * t1 + t4 * t12; - const float t17 = t12 - 3.0f * t1 * t5; - const float t20 = 3.0f * t4 * t2 - t10; - const float t21 = -t5 + t2; - const float t23 = 2.0f * t1 * t4; + float const t1 = ca; + float const t2 = t1 * t1; + float const t3 = t2 * t2; + float const t4 = sa; + float const t5 = t4 * t4; + float const t6 = t5 * t5; + float const t9 = t3 + t6 - 6.0f * t5 * t2; + float const t10 = t5 * t4; + float const t12 = t2 * t1; + float const t14 = -t10 * t1 + t4 * t12; + float const t17 = t12 - 3.0f * t1 * t5; + float const t20 = 3.0f * t4 * t2 - t10; + float const t21 = -t5 + t2; + float const t23 = 2.0f * t1 * t4; R[0] = t9; R[8] = 4.0f * t14; R[10] = t17; @@ -1251,22 +1251,22 @@ _Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, { for (int j = 0; j < 11 * 11; j++) R[j] = 0.0f; - const float t1 = ca; - const float t2 = sa; - const float t3 = t2 * t2; - const float t4 = t3 * t3; - const float t7 = t1 * t1; - const float t8 = t7 * t1; - const float t11 = t7 * t7; - const float t13 = 5.0f * t1 * t4 - 10.0f * t3 * t8 + t11 * t1; - const float t14 = t3 * t2; - const float t20 = -10.0f * t14 * t7 + 5.0f * t2 * t11 + t4 * t2; - const float t23 = t11 + t4 - 6.0f * t3 * t7; - const float t26 = -t14 * t1 + t2 * t8; - const float t29 = t8 - 3.0f * t1 * t3; - const float t32 = 3.0f * t2 * t7 - t14; - const float t33 = -t3 + t7; - const float t35 = 2.0f * t1 * t2; + float const t1 = ca; + float const t2 = sa; + float const t3 = t2 * t2; + float const t4 = t3 * t3; + float const t7 = t1 * t1; + float const t8 = t7 * t1; + float const t11 = t7 * t7; + float const t13 = 5.0f * t1 * t4 - 10.0f * t3 * t8 + t11 * t1; + float const t14 = t3 * t2; + float const t20 = -10.0f * t14 * t7 + 5.0f * t2 * t11 + t4 * t2; + float const t23 = t11 + t4 - 6.0f * t3 * t7; + float const t26 = -t14 * t1 + t2 * t8; + float const t29 = t8 - 3.0f * t1 * t3; + float const t32 = 3.0f * t2 * t7 - t14; + float const t33 = -t3 + t7; + float const t35 = 2.0f * t1 * t2; R[0] = t13; R[10] = t20; R[12] = t23; @@ -1302,12 +1302,12 @@ _Use_decl_annotations_ float* DirectX::XMSHRotateZ(float* result, size_t order, // // https://msdn.microsoft.com/en-us/library/windows/desktop/bb205438.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHAdd(float* result, size_t order, const float* inputA, const float* inputB) noexcept +_Use_decl_annotations_ float* DirectX::XMSHAdd(float* result, size_t order, float const* inputA, float const* inputB) noexcept { if (!result || !inputA || !inputB) return nullptr; - const size_t numcoeff = order * order; + size_t const numcoeff = order * order; for (size_t i = 0; i < numcoeff; ++i) { @@ -1322,12 +1322,12 @@ _Use_decl_annotations_ float* DirectX::XMSHAdd(float* result, size_t order, cons // // https://msdn.microsoft.com/en-us/library/windows/desktop/bb204994.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHScale(float* result, size_t order, const float* input, float scale) noexcept +_Use_decl_annotations_ float* DirectX::XMSHScale(float* result, size_t order, float const* input, float scale) noexcept { if (!result || !input) return nullptr; - const size_t numcoeff = order * order; + size_t const numcoeff = order * order; for (size_t i = 0; i < numcoeff; ++i) { @@ -1342,14 +1342,14 @@ _Use_decl_annotations_ float* DirectX::XMSHScale(float* result, size_t order, co // // https://msdn.microsoft.com/en-us/library/windows/desktop/bb205446.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float DirectX::XMSHDot(size_t order, const float* inputA, const float* inputB) noexcept +_Use_decl_annotations_ float DirectX::XMSHDot(size_t order, float const* inputA, float const* inputB) noexcept { if (!inputA || !inputB) return 0.f; float result = inputA[0] * inputB[0]; - const size_t numcoeff = order * order; + size_t const numcoeff = order * order; for (size_t i = 1; i < numcoeff; ++i) { @@ -1369,7 +1369,7 @@ _Use_decl_annotations_ float DirectX::XMSHDot(size_t order, const float* inputA, // that the product commutes (f*g == g*f) but doesn't associate // (f*(g*h) != (f*g)*h. //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHMultiply(float* result, size_t order, const float* inputF, const float* inputG) noexcept +_Use_decl_annotations_ float* DirectX::XMSHMultiply(float* result, size_t order, float const* inputF, float const* inputG) noexcept { switch (order) { @@ -1390,7 +1390,7 @@ _Use_decl_annotations_ float* DirectX::XMSHMultiply(float* result, size_t order, //------------------------------------------------------------------------------------- // https://msdn.microsoft.com/en-us/library/windows/desktop/bb205454.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHMultiply2(float* y, const float* f, const float* g) noexcept +_Use_decl_annotations_ float* DirectX::XMSHMultiply2(float* y, float const* f, float const* g) noexcept { if (!y || !f || !g) return nullptr; @@ -1428,7 +1428,7 @@ _Use_decl_annotations_ float* DirectX::XMSHMultiply2(float* y, const float* f, c //------------------------------------------------------------------------------------- // https://msdn.microsoft.com/en-us/library/windows/desktop/bb232906.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHMultiply3(float* y, const float* f, const float* g) noexcept +_Use_decl_annotations_ float* DirectX::XMSHMultiply3(float* y, float const* f, float const* g) noexcept { if (!y || !f || !g) return nullptr; @@ -1545,7 +1545,7 @@ _Use_decl_annotations_ float* DirectX::XMSHMultiply3(float* y, const float* f, c //------------------------------------------------------------------------------------- // https://msdn.microsoft.com/en-us/library/windows/desktop/bb232907.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHMultiply4(float* y, const float* f, const float* g) noexcept +_Use_decl_annotations_ float* DirectX::XMSHMultiply4(float* y, float const* f, float const* g) noexcept { if (!y || !f || !g) return nullptr; @@ -1875,7 +1875,7 @@ _Use_decl_annotations_ float* DirectX::XMSHMultiply4(float* y, const float* f, c //------------------------------------------------------------------------------------- // https://msdn.microsoft.com/en-us/library/windows/desktop/bb232908.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHMultiply5(float* y, const float* f, const float* g) noexcept +_Use_decl_annotations_ float* DirectX::XMSHMultiply5(float* y, float const* f, float const* g) noexcept { if (!y || !f || !g) return nullptr; @@ -2714,7 +2714,7 @@ _Use_decl_annotations_ float* DirectX::XMSHMultiply5(float* y, const float* f, c //------------------------------------------------------------------------------------- // https://msdn.microsoft.com/en-us/library/windows/desktop/bb232909.aspx //------------------------------------------------------------------------------------- -_Use_decl_annotations_ float* DirectX::XMSHMultiply6(float* y, const float* f, const float* g) noexcept +_Use_decl_annotations_ float* DirectX::XMSHMultiply6(float* y, float const* f, float const* g) noexcept { if (!y || !f || !g) return nullptr; @@ -4548,11 +4548,11 @@ DirectX::XMSHEvalDirectionalLight(size_t order, FXMVECTOR dir, FXMVECTOR color, XMSHEvalDirection(fTmp, order, dir); // evaluate the BF in this direction... // now compute "normalization" and scale vector for each valid spectral band - const float fNorm = XM_PI / CosWtInt(order); + float const fNorm = XM_PI / CosWtInt(order); - const size_t numcoeff = order * order; + size_t const numcoeff = order * order; - const float fRScale = fNorm * clr.x; + float const fRScale = fNorm * clr.x; for (size_t i = 0; i < numcoeff; ++i) { @@ -4561,7 +4561,7 @@ DirectX::XMSHEvalDirectionalLight(size_t order, FXMVECTOR dir, FXMVECTOR color, if (resultG) { - const float fGScale = fNorm * clr.y; + float const fGScale = fNorm * clr.y; for (size_t i = 0; i < numcoeff; ++i) { @@ -4571,7 +4571,7 @@ DirectX::XMSHEvalDirectionalLight(size_t order, FXMVECTOR dir, FXMVECTOR color, if (resultB) { - const float fBScale = fNorm * clr.z; + float const fBScale = fNorm * clr.z; for (size_t i = 0; i < numcoeff; ++i) { @@ -4605,12 +4605,12 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalSphericalLight(size_t o if (radius < 0.f) return false; - const float fDist = XMVectorGetX(XMVector3Length(pos)); + float const fDist = XMVectorGetX(XMVector3Length(pos)); // WARNING: fDist should not be < radius - otherwise light contains origin // const float fSinConeAngle = (fDist <= radius) ? 0.99999f : radius/fDist; - const float fConeAngle = (fDist <= radius) ? (XM_PIDIV2) : asinf(radius / fDist); + float const fConeAngle = (fDist <= radius) ? (XM_PIDIV2) : asinf(radius / fDist); XMVECTOR dir = XMVector3Normalize(pos); @@ -4634,16 +4634,16 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalSphericalLight(size_t o // no default normalization is done for this case, have to be careful how // you represent the coefficients... - const float fNewNorm = 1.0f; ///(fSinConeAngle*fSinConeAngle); + float const fNewNorm = 1.0f; ///(fSinConeAngle*fSinConeAngle); ComputeCapInt(order, fConeAngle, fTmpL0); XMFLOAT3A vd; XMStoreFloat3(&vd, dir); - const float fX = vd.x; - const float fY = vd.y; - const float fZ = vd.z; + float const fX = vd.x; + float const fY = vd.y; + float const fZ = vd.z; switch (order) { @@ -4665,9 +4665,9 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalSphericalLight(size_t o for (size_t i = 0; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * clr.x * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * clr.x * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultR[cStart + j] = fTmpDir[cStart + j] * fValUse; } @@ -4676,9 +4676,9 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalSphericalLight(size_t o { for (size_t i = 0; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * clr.y * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * clr.y * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultG[cStart + j] = fTmpDir[cStart + j] * fValUse; } @@ -4688,9 +4688,9 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalSphericalLight(size_t o { for (size_t i = 0; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * clr.z * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * clr.z * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultB[cStart + j] = fTmpDir[cStart + j] * fValUse; } @@ -4733,19 +4733,19 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalConeLight(size_t order, float fTmpL0[XM_SH_MAXORDER]; float fTmpDir[XM_SH_MAXORDER * XM_SH_MAXORDER]; - const float fConeAngle = radius; - const float fAngCheck = (fConeAngle > XM_PIDIV2) ? (XM_PIDIV2) : fConeAngle; + float const fConeAngle = radius; + float const fAngCheck = (fConeAngle > XM_PIDIV2) ? (XM_PIDIV2) : fConeAngle; - const float fNewNorm = 1.0f / (sinf(fAngCheck) * sinf(fAngCheck)); + float const fNewNorm = 1.0f / (sinf(fAngCheck) * sinf(fAngCheck)); ComputeCapInt(order, fConeAngle, fTmpL0); XMFLOAT3A vd; XMStoreFloat3(&vd, dir); - const float fX = vd.x; - const float fY = vd.y; - const float fZ = vd.z; + float const fX = vd.x; + float const fY = vd.y; + float const fZ = vd.z; switch (order) { @@ -4767,9 +4767,9 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalConeLight(size_t order, for (size_t i = 0; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * clr.x * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * clr.x * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultR[cStart + j] = fTmpDir[cStart + j] * fValUse; } @@ -4778,9 +4778,9 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalConeLight(size_t order, { for (size_t i = 0; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * clr.y * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * clr.y * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultG[cStart + j] = fTmpDir[cStart + j] * fValUse; } @@ -4790,9 +4790,9 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalConeLight(size_t order, { for (size_t i = 0; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * clr.z * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * clr.z * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultB[cStart + j] = fTmpDir[cStart + j] * fValUse; } @@ -4834,14 +4834,14 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalHemisphereLight(size_t float fTmpDir[XM_SH_MAXORDER * XM_SH_MAXORDER]; // rotation "vector" float fTmpL0[XM_SH_MAXORDER]; - const float fNewNorm = 3.0f / 2.0f; // normalizes things for 1 sky color, 0 ground color... + float const fNewNorm = 3.0f / 2.0f; // normalizes things for 1 sky color, 0 ground color... XMFLOAT3A vd; XMStoreFloat3(&vd, dir); - const float fX = vd.x; - const float fY = vd.y; - const float fZ = vd.z; + float const fX = vd.x; + float const fY = vd.y; + float const fZ = vd.z; sh_eval_basis_1(fX, fY, fZ, fTmpDir); @@ -4861,17 +4861,17 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalHemisphereLight(size_t for (; i < 2; ++i) { _Analysis_assume_(i < order); - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultR[cStart + j] = fTmpDir[cStart + j] * fValUse; } for (; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; for (size_t j = 0; j < cNumCoefs; ++j) resultR[cStart + j] = 0.0f; } @@ -4887,17 +4887,17 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalHemisphereLight(size_t for (i = 0; i < 2; ++i) { _Analysis_assume_(i < order); - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultG[cStart + j] = fTmpDir[cStart + j] * fValUse; } for (; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; for (size_t j = 0; j < cNumCoefs; ++j) resultG[cStart + j] = 0.0f; } @@ -4914,17 +4914,17 @@ _Use_decl_annotations_ bool XM_CALLCONV DirectX::XMSHEvalHemisphereLight(size_t for (i = 0; i < 2; ++i) { _Analysis_assume_(i < order); - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; - const float fValUse = fTmpL0[i] * fNewNorm * fExtraNormFac[i]; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; + float const fValUse = fTmpL0[i] * fNewNorm * fExtraNormFac[i]; for (size_t j = 0; j < cNumCoefs; ++j) resultB[cStart + j] = fTmpDir[cStart + j] * fValUse; } for (; i < order; ++i) { - const size_t cNumCoefs = 2 * i + 1; - const size_t cStart = i * i; + size_t const cNumCoefs = 2 * i + 1; + size_t const cStart = i * i; for (size_t j = 0; j < cNumCoefs; ++j) resultB[cStart + j] = 0.0f; } diff --git a/SHMath/DirectXSHD3D11.cpp b/SHMath/DirectXSHD3D11.cpp index ea04a53..e91d26a 100644 --- a/SHMath/DirectXSHD3D11.cpp +++ b/SHMath/DirectXSHD3D11.cpp @@ -143,7 +143,7 @@ namespace case DXGI_FORMAT_R32_FLOAT: if (size >= sizeof(float)) { - const float* __restrict sPtr = reinterpret_cast(pSource); + float const* __restrict sPtr = reinterpret_cast(pSource); for (size_t icount = 0; icount < size; icount += sizeof(float)) { XMVECTOR v = XMLoadFloat(sPtr++); @@ -285,7 +285,7 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(ID3D11DeviceContext* co if (FAILED(hr)) return hr; - const uint8_t* pSrc = reinterpret_cast(mapped.pData); + uint8_t const* pSrc = reinterpret_cast(mapped.pData); for (UINT y = 0; y < desc.Height; ++y) { XMVECTOR* ptr = scanline.get(); @@ -295,12 +295,12 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(ID3D11DeviceContext* co return E_FAIL; } - const float v = float(y) * fS + fB; + float const v = float(y) * fS + fB; XMVECTOR* pixel = ptr; for (UINT x = 0; x < desc.Width; ++x, ++pixel) { - const float u = float(x) * fS + fB; + float const u = float(x) * fS + fB; float ix, iy, iz; switch (face) @@ -350,7 +350,7 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(ID3D11DeviceContext* co XMVECTOR dir = XMVectorSet(ix, iy, iz, 0); dir = XMVector3Normalize(dir); - const float fDiffSolid = 4.0f / ((1.0f + u * u + v * v) * sqrtf(1.0f + u * u + v * v)); + float const fDiffSolid = 4.0f / ((1.0f + u * u + v * v) * sqrtf(1.0f + u * u + v * v)); fWt += fDiffSolid; XMSHEvalDirection(shBuff, order, dir); @@ -372,7 +372,7 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(ID3D11DeviceContext* co context->Unmap(texture, dindex); } - const float fNormProj = (4.0f * XM_PI) / fWt; + float const fNormProj = (4.0f * XM_PI) / fWt; if (resultR) XMSHScale(resultR, order, resultR, fNormProj); diff --git a/SHMath/DirectXSHD3D12.cpp b/SHMath/DirectXSHD3D12.cpp index 25eeef7..8c5e9f9 100644 --- a/SHMath/DirectXSHD3D12.cpp +++ b/SHMath/DirectXSHD3D12.cpp @@ -146,7 +146,7 @@ namespace case DXGI_FORMAT_R32_FLOAT: if (size >= sizeof(float)) { - const float* __restrict sPtr = reinterpret_cast(pSource); + float const* __restrict sPtr = reinterpret_cast(pSource); for (size_t icount = 0; icount < size; icount += sizeof(float)) { XMVECTOR v = XMLoadFloat(sPtr++); @@ -253,7 +253,7 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(size_t order, if (!cubeMap[face].pData) return E_POINTER; - const uint8_t* pSrc = reinterpret_cast(cubeMap[face].pData); + uint8_t const* pSrc = reinterpret_cast(cubeMap[face].pData); for (UINT y = 0; y < desc.Height; ++y) { XMVECTOR* ptr = scanline.get(); @@ -262,12 +262,12 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(size_t order, return E_FAIL; } - const float v = float(y) * fS + fB; + float const v = float(y) * fS + fB; XMVECTOR* pixel = ptr; for (UINT x = 0; x < desc.Width; ++x, ++pixel) { - const float u = float(x) * fS + fB; + float const u = float(x) * fS + fB; float ix, iy, iz; switch (face) @@ -317,7 +317,7 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(size_t order, XMVECTOR dir = XMVectorSet(ix, iy, iz, 0); dir = XMVector3Normalize(dir); - const float fDiffSolid = 4.0f / ((1.0f + u * u + v * v) * sqrtf(1.0f + u * u + v * v)); + float const fDiffSolid = 4.0f / ((1.0f + u * u + v * v) * sqrtf(1.0f + u * u + v * v)); fWt += fDiffSolid; XMSHEvalDirection(shBuff, order, dir); @@ -337,7 +337,7 @@ _Use_decl_annotations_ HRESULT DirectX::SHProjectCubeMap(size_t order, } } - const float fNormProj = (4.0f * XM_PI) / fWt; + float const fNormProj = (4.0f * XM_PI) / fWt; if (resultR) XMSHScale(resultR, order, resultR, fNormProj); diff --git a/Stereo3D/Stereo3DMatrixHelper.cpp b/Stereo3D/Stereo3DMatrixHelper.cpp index cee4609..3a2e989 100644 --- a/Stereo3D/Stereo3DMatrixHelper.cpp +++ b/Stereo3D/Stereo3DMatrixHelper.cpp @@ -40,9 +40,9 @@ namespace // the viewer than 1.6 degrees (divided by two for most // half-angle calculations) - static const float fMaxStereoDistance = 780; // inches (should be between 10 and 20m) - static const float fMaxVisualAcuityAngle = 1.6f * (XM_PI / 180.0f); // radians - static const float fInterocularDistance = 1.25f; // inches + static float const fMaxStereoDistance = 780; // inches (should be between 10 and 20m) + static float const fMaxVisualAcuityAngle = 1.6f * (XM_PI / 180.0f); // radians + static float const fInterocularDistance = 1.25f; // inches float fDisplayHeight = stereoParameters.fDisplaySizeInches / sqrtf(AspectRatio * AspectRatio + 1.0f); float fDisplayWidth = fDisplayHeight * AspectRatio; diff --git a/XDSP/XDSP.h b/XDSP/XDSP.h index bd56986..3e41221 100644 --- a/XDSP/XDSP.h +++ b/XDSP/XDSP.h @@ -243,7 +243,7 @@ namespace XDSP //---------------------------------------------------------------------------------- inline void FFT4(_Inout_updates_(uCount) XMVECTOR* __restrict pReal, _Inout_updates_(uCount) XMVECTOR* __restrict pImaginary, - const size_t uCount = 1) noexcept + size_t const uCount = 1) noexcept { assert(pReal); assert(pImaginary); @@ -386,19 +386,19 @@ namespace XDSP const XMVECTOR* __restrict pUnityTableReal = pUnityTable; const XMVECTOR* __restrict pUnityTableImaginary = pUnityTable + (uLength >> 2); - const size_t uTotal = uCount * uLength; - const size_t uTotal_vectors = uTotal >> 2; - const size_t uStage_vectors = uLength >> 2; - const size_t uStage_vectors_mask = uStage_vectors - 1; - const size_t uStride = uLength >> 4; // stride between butterfly elements - const size_t uStrideMask = uStride - 1; - const size_t uStride2 = uStride * 2; - const size_t uStride3 = uStride * 3; - const size_t uStrideInvMask = ~uStrideMask; + size_t const uTotal = uCount * uLength; + size_t const uTotal_vectors = uTotal >> 2; + size_t const uStage_vectors = uLength >> 2; + size_t const uStage_vectors_mask = uStage_vectors - 1; + size_t const uStride = uLength >> 4; // stride between butterfly elements + size_t const uStrideMask = uStride - 1; + size_t const uStride2 = uStride * 2; + size_t const uStride3 = uStride * 3; + size_t const uStrideInvMask = ~uStrideMask; for (size_t uIndex = 0; uIndex < (uTotal_vectors >> 2); ++uIndex) { - const size_t n = ((uIndex & uStrideInvMask) << 2) + (uIndex & uStrideMask); + size_t const n = ((uIndex & uStrideInvMask) << 2) + (uIndex & uStrideMask); ButterflyDIT4_4(pReal[n], pReal[n + uStride], pReal[n + uStride2], @@ -522,9 +522,9 @@ namespace XDSP _Analysis_assume_(uLog2Length >= 2); float* __restrict pfOutput = reinterpret_cast(pOutput); - const size_t uLength = size_t(1) << (uLog2Length - 2); + size_t const uLength = size_t(1) << (uLog2Length - 2); - static const unsigned char cSwizzleTable[256] = { + static unsigned char const cSwizzleTable[256] = { // clang-format off 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, 0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4, @@ -547,13 +547,13 @@ namespace XDSP if ((uLog2Length & 1) == 0) { // even powers of two - const size_t uRev32 = 32 - uLog2Length; + size_t const uRev32 = 32 - uLog2Length; for (size_t uIndex = 0; uIndex < uLength; ++uIndex) { XMFLOAT4A f4a; XMStoreFloat4A(&f4a, pInput[uIndex]); - const size_t n = uIndex * 4; - const size_t uAddr + size_t const n = uIndex * 4; + size_t const uAddr = (static_cast(cSwizzleTable[n & 0xff]) << 24) | (static_cast(cSwizzleTable[(n >> 8) & 0xff]) << 16) | (static_cast(cSwizzleTable[(n >> 16) & 0xff]) << 8) | (static_cast(cSwizzleTable[(n >> 24)])); pfOutput[uAddr >> uRev32] = f4a.x; @@ -565,13 +565,13 @@ namespace XDSP else { // odd powers of two - const size_t uRev7 = size_t(1) << (uLog2Length - 3); - const size_t uRev32 = 32 - (uLog2Length - 3); + size_t const uRev7 = size_t(1) << (uLog2Length - 3); + size_t const uRev32 = 32 - (uLog2Length - 3); for (size_t uIndex = 0; uIndex < uLength; ++uIndex) { XMFLOAT4A f4a; XMStoreFloat4A(&f4a, pInput[uIndex]); - const size_t n = (uIndex >> 1); + size_t const n = (uIndex >> 1); size_t uAddr = (((static_cast(cSwizzleTable[n & 0xff]) << 24) | (static_cast(cSwizzleTable[(n >> 8) & 0xff]) << 16) | (static_cast(cSwizzleTable[(n >> 16) & 0xff]) << 8) | (static_cast(cSwizzleTable[(n >> 24)]))) @@ -615,7 +615,7 @@ namespace XDSP _Analysis_assume_(uLength >= 4); assert(ISPOWEROF2(uLength)); - const float flOneOverLength = 1.0f / float(uLength); + float const flOneOverLength = 1.0f / float(uLength); // result = sqrtf((real/uLength)^2 + (imaginary/uLength)^2) * 2 const XMVECTOR vOneOverLength = XMVectorReplicate(flOneOverLength); @@ -656,7 +656,7 @@ namespace XDSP assert(uFrameCount > 0); float* __restrict pfOutput = reinterpret_cast(pOutput); - const float* __restrict pfInput = reinterpret_cast(pInput); + float const* __restrict pfInput = reinterpret_cast(pInput); for (size_t uChannel = 0; uChannel < uChannelCount; ++uChannel) { @@ -691,7 +691,7 @@ namespace XDSP assert(uFrameCount > 0); float* __restrict pfOutput = reinterpret_cast(pOutput); - const float* __restrict pfInput = reinterpret_cast(pInput); + float const* __restrict pfInput = reinterpret_cast(pInput); for (size_t uChannel = 0; uChannel < uChannelCount; ++uChannel) { @@ -732,7 +732,7 @@ namespace XDSP XM_ALIGNED_DATA(16) XMVECTOR vRealTemp[768]; XM_ALIGNED_DATA(16) XMVECTOR vImaginaryTemp[768]; - const size_t uLength = size_t(1) << uLog2Length; + size_t const uLength = size_t(1) << uLog2Length; if (uChannelCount > 1) { @@ -815,7 +815,7 @@ namespace XDSP XM_ALIGNED_DATA(16) XMVECTOR vRealTemp[768] = {}; XM_ALIGNED_DATA(16) XMVECTOR vImaginaryTemp[768] = {}; - const size_t uLength = size_t(1) << uLog2Length; + size_t const uLength = size_t(1) << uLog2Length; const XMVECTOR vRnp = XMVectorReplicate(1.0f / float(uLength)); const XMVECTOR vRnm = XMVectorReplicate(-1.0f / float(uLength));