[Mesa-dev] [PATCH 05/16] glsl: Change to using switch-case in get_range
Thomas Helland
thomashelland90 at gmail.com
Sun Nov 16 17:51:50 PST 2014
This will make expansion easier and less cluttered.
---
src/glsl/opt_minmax.cpp | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 89970d5..111d183 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -268,11 +268,20 @@ static minmax_range
get_range(ir_rvalue *rval)
{
ir_expression *expr = rval->as_expression();
- if (expr && (expr->operation == ir_binop_min ||
- expr->operation == ir_binop_max)) {
- minmax_range r0 = get_range(expr->operands[0]);
- minmax_range r1 = get_range(expr->operands[1]);
- return combine_range(r0, r1, expr->operation == ir_binop_min);
+ minmax_range r0;
+ minmax_range r1;
+
+ if(expr) {
+ switch(expr->operation) {
+ case ir_binop_min:
+ case ir_binop_max:
+ r0 = get_range(expr->operands[0]);
+ r1 = get_range(expr->operands[1]);
+ return combine_range(r0, r1, expr->operation == ir_binop_min);
+
+ default:
+ break;
+ }
}
ir_constant *c = rval->as_constant();
--
2.0.3
More information about the mesa-dev
mailing list