From 1d09c41e18e75bd51bc463106f7a168a47a247fc Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Mon, 1 Apr 2024 13:23:52 +0300 Subject: [PATCH] make xor enable in SSEonly + fast math --- include/cglm/simd/x86.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/cglm/simd/x86.h b/include/cglm/simd/x86.h index 071a2721..b107a36d 100644 --- a/include/cglm/simd/x86.h +++ b/include/cglm/simd/x86.h @@ -55,8 +55,20 @@ #endif /* Note that `0x80000000` corresponds to `INT_MIN` for a 32-bit int. */ -#define GLMM_NEGZEROf ((int)0x80000000) /* 0x80000000 ---> -0.0f */ -#define GLMM_POSZEROf ((int)0x00000000) /* 0x00000000 ---> +0.0f */ + +#if defined(__SSE2__) +# define GLMM_NEGZEROf ((int)0x80000000) /* 0x80000000 ---> -0.0f */ +# define GLMM_POSZEROf ((int)0x00000000) /* 0x00000000 ---> +0.0f */ +#else +# ifdef CGLM_FAST_MATH + union { int i; float f; } static GLMM_NEGZEROf_TU = { .i = 0x80000000 }; +# define GLMM_NEGZEROf GLMM_NEGZEROf_TU.f +# define GLMM_POSZEROf 0.0f +# else +# define GLMM_NEGZEROf -0.0f +# define GLMM_POSZEROf 0.0f +# endif +#endif #if defined(__SSE2__) # define GLMM__SIGNMASKf(X, Y, Z, W) \