normalize: norm == 0.0f to norm < FLT_EPSILON, improving handling of very small vectors to prevent instability and overflow

This commit is contained in:
Recep Aslantas
2024-03-25 02:22:46 +03:00
parent 6a7d03bafb
commit 1de373a9bd
8 changed files with 30 additions and 22 deletions

View File

@@ -37,6 +37,14 @@
# define CGLM_INLINE static inline __attribute((always_inline))
#endif
#if defined(__GNUC__) || defined(__clang__)
# define CGLM_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
# define CGLM_LIKELY(expr) __builtin_expect(!!(expr), 1)
#else
# define CGLM_UNLIKELY(expr) (expr)
# define CGLM_LIKELY(expr) (expr)
#endif
#define GLM_SHUFFLE4(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
#define GLM_SHUFFLE3(z, y, x) (((z) << 4) | ((y) << 2) | (x))