summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-10-19 08:21:38 -0600
committerBrian Paul <[email protected]>2013-10-22 08:20:45 -0600
commitf0d4636d9c4098fd7ccc533258e7a5173e98d847 (patch)
treecc5fb8d20b96021ccd5a4c58e57ffe5241d7435c /src/mesa/main
parent6767c56e6d36b872096d32507c89c56b6d8618d1 (diff)
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 <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/macros.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 880c6564e18..379f7566387 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -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));
}
/*@}*/