[Mesa-dev] [PATCH 3/6] glsl: Change to using switch-case in get_range
Thomas Helland
thomashelland90 at gmail.com
Wed Oct 29 18:11:18 PDT 2014
This will make expansion easier and less cluttered.
Signed-off-by: Thomas Helland <thomashelland90 at gmail.com>
---
src/glsl/opt_minmax.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index e4141bc..b21daca 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -269,11 +269,16 @@ 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);
}
ir_constant *c = rval->as_constant();
--
2.0.3
More information about the mesa-dev
mailing list