Commit fbb13303 authored by Evan Ramos's avatar Evan Ramos

Avoid error with some toolchains where klabs(int16_t) turns into abs(double)

parent 3ad3d65f
......@@ -264,7 +264,12 @@ static FORCE_INLINE int32_t klabs(int32_t const a)
return (a ^ m) - m;
}
#else
#define klabs(x) abs(x)
# ifdef __cplusplus
// some toolchains use the double version of abs for small int types, so avoid that
static FORCE_INLINE CONSTEXPR int32_t klabs(int32_t const a) { return abs(a); }
# else
# define klabs(x) abs(x)
# endif
#endif
#endif
#ifndef pragmas_have_ksgn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment