Fixed initialization and comparison of variable Types
TRAC #12262
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: http://angleproject.googlecode.com/svn/trunk@280 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index e2ae57d..08614b4 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -2006,7 +2006,7 @@
if (x.type != y.type)
{
- return memcmp(&x.type, &y.type, sizeof(TType)) < 0;
+ return x.type < y.type;
}
if (x.parameters.size() != y.parameters.size())
@@ -2018,7 +2018,7 @@
{
if (x.parameters[i] != y.parameters[i])
{
- return memcmp(&x.parameters[i], &y.parameters[i], sizeof(TType)) < 0;
+ return x.parameters[i] < y.parameters[i];
}
}
diff --git a/src/compiler/Types.h b/src/compiler/Types.h
index ed6bf05..e498f5a 100644
--- a/src/compiler/Types.h
+++ b/src/compiler/Types.h
@@ -101,7 +101,7 @@
}
explicit TType(TTypeList* userDef, const TString& n, TPrecision p = EbpHigh) :
type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0),
- structure(userDef), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) {
+ structure(userDef), structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) {
typeName = NewPoolTString(n.c_str());
}
explicit TType() {}
@@ -276,6 +276,16 @@
bool operator!=(const TType& right) const {
return !operator==(right);
}
+ bool operator<(const TType& right) const {
+ if (type != right.type) return type < right.type;
+ if (size != right.size) return size < right.size;
+ if (matrix != right.matrix) return matrix < right.matrix;
+ if (array != right.array) return array < right.array;
+ if (arraySize != right.arraySize) return arraySize < right.arraySize;
+ if (structure != right.structure) return structure < right.structure;
+
+ return false;
+ }
TString getCompleteString() const;
protected: