summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-07-20 03:01:54 -0700
committerKenneth Graunke <[email protected]>2010-07-21 16:38:32 -0700
commit3163f87463e6d0123c4f95bd76a658cb1e5d0843 (patch)
treea7322032e5d37587a5448fb67493fbfced206b0e /src/glsl/ir_constant_expression.cpp
parent0048c7aef82b17c6bd160f49125a91a70cbf2b55 (diff)
ir_constant_expression: Remove open coded equality comparisons.
The ir_constant::has_value method already does this.
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r--src/glsl/ir_constant_expression.cpp40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index cb07f381281..b0333dbebb7 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -603,46 +603,10 @@ ir_expression::constant_expression_value()
break;
case ir_binop_equal:
- data.b[0] = true;
- for (unsigned c = 0; c < op[0]->type->components(); c++) {
- switch (op[0]->type->base_type) {
- case GLSL_TYPE_UINT:
- data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c];
- break;
- case GLSL_TYPE_INT:
- data.b[0] = data.b[0] && op[0]->value.i[c] == op[1]->value.i[c];
- break;
- case GLSL_TYPE_FLOAT:
- data.b[0] = data.b[0] && op[0]->value.f[c] == op[1]->value.f[c];
- break;
- case GLSL_TYPE_BOOL:
- data.b[0] = data.b[0] && op[0]->value.b[c] == op[1]->value.b[c];
- break;
- default:
- assert(0);
- }
- }
+ data.b[0] = op[0]->has_value(op[1]);
break;
case ir_binop_nequal:
- data.b[0] = false;
- for (unsigned c = 0; c < op[0]->type->components(); c++) {
- switch (op[0]->type->base_type) {
- case GLSL_TYPE_UINT:
- data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c];
- break;
- case GLSL_TYPE_INT:
- data.b[0] = data.b[0] || op[0]->value.i[c] != op[1]->value.i[c];
- break;
- case GLSL_TYPE_FLOAT:
- data.b[0] = data.b[0] || op[0]->value.f[c] != op[1]->value.f[c];
- break;
- case GLSL_TYPE_BOOL:
- data.b[0] = data.b[0] || op[0]->value.b[c] != op[1]->value.b[c];
- break;
- default:
- assert(0);
- }
- }
+ data.b[0] = !op[0]->has_value(op[1]);
break;
default: