Merge pull request #26 from maruncz/hotfix/abs-signed-overflow

signed integer overflow is undefined behavior
This commit is contained in:
Petteri Aimonen 2021-04-27 12:32:08 +03:00 committed by GitHub
commit 951f522b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)