mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 03:28:09 +02:00
mesa: fix a couple issues with U_FIXED, I_FIXED macros
Silence a bunch of MSVC type conversion warnings. Changed return type of S_FIXED to int32_t (signed). The result is the same. It just seems more intuitive that a signed conversion function should return a signed value. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
6767c56e6d
commit
f0d4636d9c
1 changed files with 3 additions and 3 deletions
|
|
@ -193,7 +193,7 @@ static INLINE uint32_t
|
|||
U_FIXED(float value, uint32_t frac_bits)
|
||||
{
|
||||
value *= (1 << frac_bits);
|
||||
return value < 0 ? 0 : value;
|
||||
return value < 0.0f ? 0 : (uint32_t) value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -201,10 +201,10 @@ U_FIXED(float value, uint32_t frac_bits)
|
|||
*
|
||||
* \param frac_bits The number of bits used to store the fractional part.
|
||||
*/
|
||||
static INLINE uint32_t
|
||||
static INLINE int32_t
|
||||
S_FIXED(float value, uint32_t frac_bits)
|
||||
{
|
||||
return value * (1 << frac_bits);
|
||||
return (int32_t) (value * (1 << frac_bits));
|
||||
}
|
||||
/*@}*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue