summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-24 17:53:53 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-24 17:53:53 -0700
commit664da2510aa11c5319acad3bd6e96a9504a0b3fc (patch)
tree75531116ba55e501526c60356d06c22d693b359e /ast_to_hir.cpp
parent532edd9bc49ce3430e5084957e2ecf453d1c3d24 (diff)
Replace several field comparisons with a single pointer comparison
The only way the specified type fields can match is if the types are the same. Previous tests (and assertions) have filtered away all other possible cases.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 5fe44ec469..cb746ed59a 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -151,10 +151,7 @@ arithmetic_result_type(const struct glsl_type *type_a,
* vector."
*/
if (type_a->is_vector() && type_b->is_vector()) {
- if (type_a->vector_elements == type_b->vector_elements)
- return type_a;
- else
- return glsl_error_type;
+ return (type_a == type_b) ? type_a : glsl_error_type;
}
/* All of the combinations of <scalar, scalar>, <vector, scalar>,
@@ -183,12 +180,7 @@ arithmetic_result_type(const struct glsl_type *type_a,
* more detail how vectors and matrices are operated on."
*/
if (! multiply) {
- if (type_a->is_matrix() && type_b->is_matrix()
- && (type_a->vector_elements == type_b->vector_elements)
- && (type_a->matrix_rows == type_b->matrix_rows))
- return type_a;
- else
- return glsl_error_type;
+ return (type_a == type_b) ? type_a : glsl_error_type;
} else {
if (type_a->is_matrix() && type_b->is_matrix()) {
if (type_a->vector_elements == type_b->matrix_rows) {