Closed CaspianA1 closed 1 year ago
Hi @CaspianA1,
Good catch thanks, yes glmm_float32x4_SIGNMASK_NEG should also use GLMM_NEGZEROf
0x80000000 is easy to read, it could be written as (int)0x80000000
but -2147483648
is also fine, what about using INT_MIN
( if it is not platform dependent ) which is -2147483648
?
// ...
#include <limits.h>
// ...
#define GLMM_NEGZEROf INT_MIN /* 0x80000000 ( -2147483648 ) ---> -0.0f */
Hi @recp,
I think that leaving GLMM_NEGZEROf
as 0x80000000
would probably be fine; INT_MIN
is platform-dependent, so we could make the definition of GLMM_NEGZEROf
to this, and leave a comment above:
/* Note that `0x80000000` corresponds to `INT_MIN` for a 32-bit int. */
#define GLMM_NEGZEROf ((int) 0x80000000) /* 0x80000000 ---> -0.0f */
Sounds good?
Yes looks good, thanks for quick response, maybe a PR? :) otherwise I'll
I'm quite busy the next week :( would you have time to do a PR?
@CaspianA1 sure, the PR: https://github.com/recp/cglm/pull/311
The PR is merged, feel free to bring any issues, ideas, feedbacks 🚀
Awesome (:
When using the
-Wsign-conversion
flag and compiling with Clang, a bunch of sign conversion warnings are spit out. See below. The problems originate in x86.h, from these two lines:The conversion warnings happen because
GLMM_NEGZEROf
, which expands to an integer type, overflows.The warnings can be resolved by changing the definition of
GLMM_NEGZEROf
to-2147483648
, and by using this new defintiion ofGLMM_NEGZEROf
inglmm_float32x4_SIGNMASK_NEG
(which should have been using that macro in the first place).I unfortunately am quite busy day-to-day, could someone please pick this up and make a PR?