MCPcopy Index your code
hub / github.com/HandmadeMath/HandmadeMath / HMM_DotV4

Function HMM_DotV4

HandmadeMath.h:942–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940
941COVERAGE(HMM_DotV4, 1)
942static inline float HMM_DotV4(HMM_Vec4 Left, HMM_Vec4 Right)
943{
944 ASSERT_COVERED(HMM_DotV4);
945
946 float Result;
947
948 // NOTE(zak): IN the future if we wanna check what version SSE is support
949 // we can use _mm_dp_ps (4.3) but for now we will use the old way.
950 // Or a r = _mm_mul_ps(v1, v2), r = _mm_hadd_ps(r, r), r = _mm_hadd_ps(r, r) for SSE3
951#ifdef HANDMADE_MATH__USE_SSE
952 __m128 SSEResultOne = _mm_mul_ps(Left.SSE, Right.SSE);
953 __m128 SSEResultTwo = _mm_shuffle_ps(SSEResultOne, SSEResultOne, _MM_SHUFFLE(2, 3, 0, 1));
954 SSEResultOne = _mm_add_ps(SSEResultOne, SSEResultTwo);
955 SSEResultTwo = _mm_shuffle_ps(SSEResultOne, SSEResultOne, _MM_SHUFFLE(0, 1, 2, 3));
956 SSEResultOne = _mm_add_ps(SSEResultOne, SSEResultTwo);
957 _mm_store_ss(&Result, SSEResultOne);
958#else
959 Result = ((Left.X * Right.X) + (Left.Z * Right.Z)) + ((Left.Y * Right.Y) + (Left.W * Right.W));
960#endif
961
962 return Result;
963}
964
965COVERAGE(HMM_Cross, 1)
966static inline HMM_Vec3 HMM_Cross(HMM_Vec3 Left, HMM_Vec3 Right)

Callers 4

HMM_LenSqrV4Function · 0.85
HMM_NormV4Function · 0.85
HMM_DotFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected