diff options
author | Antoine Soulier <asoulier@google.com> | 2024-04-25 10:41:44 -0700 |
---|---|---|
committer | Antoine Soulier <asoulier@google.com> | 2024-04-25 10:41:44 -0700 |
commit | ac02cce7c3438d617770bcda17f97a5241c1709d (patch) | |
tree | 4b23e5c7d8ce50a55bc95dcc40a8f719c81cdd37 | |
parent | 73bbc00245d9874ef3e8bc8ef6476e6fee9f42aa (diff) | |
download | liblc3-ac02cce7c3438d617770bcda17f97a5241c1709d.tar.gz |
fastmath: Prefer signed addition instead of unsigned wrappedupstream-main
-rw-r--r-- | src/fastmath.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fastmath.h b/src/fastmath.h index 221d69f..c61ae64 100644 --- a/src/fastmath.h +++ b/src/fastmath.h @@ -42,10 +42,10 @@ * return 2^exp */ static inline float lc3_ldexpf(float _x, int exp) { - union { float f; uint32_t u; } x = { .f = _x }; + union { float f; int32_t s; } x = { .f = _x }; - if (x.u & LC3_IEEE754_EXP_MASK) - x.u += exp << LC3_IEEE754_EXP_SHL; + if (x.s & LC3_IEEE754_EXP_MASK) + x.s += exp << LC3_IEEE754_EXP_SHL; return x.f; } |