mirror of
https://github.com/google/liblc3.git
synced 2026-06-01 09:27:01 +00:00
fastmath: Prefer signed addition instead of unsigned wrapped
This commit is contained in:
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user