fixed: signed integer overflow is undefined behavior

This commit is contained in:
maruncz 2021-04-27 11:08:33 +02:00
parent b20bdb01d9
commit ba0991de3e
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ static inline fix16_t fix16_from_dbl(double a)
#define F16(x) ((fix16_t)(((x) >= 0) ? ((x) * 65536.0 + 0.5) : ((x) * 65536.0 - 0.5)))
static inline fix16_t fix16_abs(fix16_t x)
{ return (x < 0 ? -x : x); }
{ return (x < 0 ? -(uint32_t)x : x); }
static inline fix16_t fix16_floor(fix16_t x)
{ return (x & 0xFFFF0000UL); }
static inline fix16_t fix16_ceil(fix16_t x)