From 81659df32d9c7d2268af1dc6d02401bf04fac15c Mon Sep 17 00:00:00 2001 From: Zakary Strange Date: Sat, 11 Jan 2020 18:56:15 -0800 Subject: [PATCH] SSE HMM_EqualsVec4 --- HandmadeMath.h | 8 +++++++- README.md | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/HandmadeMath.h b/HandmadeMath.h index e2ba070..c85b5b0 100644 --- a/HandmadeMath.h +++ b/HandmadeMath.h @@ -1002,8 +1002,14 @@ COVERAGE(HMM_EqualsVec4, 1) HMM_INLINE hmm_bool HMM_EqualsVec4(hmm_vec4 Left, hmm_vec4 Right) { ASSERT_COVERED(HMM_EqualsVec4); + + hmm_bool Result; - hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W); +#if HANDMADE_MATH__USE_SSE + Result = _mm_movemask_ps(_mm_cmpeq_ps(Left.InternalElementsSSE, Right.InternalElementsSSE)) == 0xF ? 1 : 0; +#else + Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W); +#endif return (Result); } diff --git a/README.md b/README.md index f7b8e22..c9372c7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ To get started, go download [the latest release](https://github.com/HandmadeMath Version | Changes | ----------------|----------------| -**1.10.1** | Removed stdint.h, this doesn't exist on some really old compilers and we didn't really use it anyways. | +**1.10.2** | Introduced safe floating point comparrision in HMM_EqualsVec2, HMM_EqualsVec3, HMM_EqualsVec4. | +**1.10.1** | Removed use of stdint.h, this doesn't exist on some really old compilers and we didn't really use it anyways. | **1.10.0** | Made HMM_Perspective use vertical FOV instead of horizontal FOV for consistency with other graphics APIs. | **1.9.0** | Added SSE versions of quaternion operations. | **1.8.0** | Added fast vector normalization routines that use fast inverse square roots.