Add explicit cast in fix16_from_dbl()
This fixes the error: implicit conversion from 'float' to 'double' to match other operand of binary expression When the compiler options -fsingle-precision-constant -Wdouble-promotion are set
This commit is contained in:
parent
47a5aa74ff
commit
3b7f96f982
|
@ -70,7 +70,7 @@ static inline fix16_t fix16_from_dbl(double a)
|
||||||
{
|
{
|
||||||
double temp = a * fix16_one;
|
double temp = a * fix16_one;
|
||||||
#ifndef FIXMATH_NO_ROUNDING
|
#ifndef FIXMATH_NO_ROUNDING
|
||||||
temp += (temp >= 0) ? 0.5f : -0.5f;
|
temp += (double)((temp >= 0) ? 0.5f : -0.5f);
|
||||||
#endif
|
#endif
|
||||||
return (fix16_t)temp;
|
return (fix16_t)temp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue