[Mesa-dev] [PATCH 10/11] glsl: make round_to_even() return float

Brian Paul brianp at vmware.com
Tue Jan 22 16:51:20 PST 2013


GLSL's roundEven() doesn't return an int and this fixes an MSVC
warning where the returned value is being assigned to a float.
---
 src/glsl/ir_constant_expression.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 17b54b9..8d8d048 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -46,7 +46,7 @@
  * purposes.  Mesa's IROUND macro is close to what we want, but it
  * rounds away from 0 on n + 0.5.
  */
-static int
+static float
 round_to_even(float val)
 {
    int rounded = IROUND(val);
@@ -56,7 +56,7 @@ round_to_even(float val)
 	 rounded += val > 0 ? -1 : 1;
    }
 
-   return rounded;
+   return (float) rounded;
 }
 
 static float
-- 
1.7.3.4



More information about the mesa-dev mailing list