diff options
Diffstat (limited to 'Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h')
-rw-r--r-- | Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h | 68 |
1 files changed, 18 insertions, 50 deletions
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h b/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h index cf531ea..fd9d94d 100644 --- a/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h +++ b/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h @@ -11,6 +11,10 @@ class ConstantUnion { public: + ConstantUnion() + { + iConst = 0; + } POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) void setIConst(int i) {iConst = i; type = EbtInt; } @@ -26,26 +30,17 @@ public: bool operator==(const int i) const { - if (i == iConst) - return true; - - return false; + return i == iConst; } bool operator==(const float f) const { - if (f == fConst) - return true; - - return false; + return f == fConst; } bool operator==(const bool b) const { - if (b == bConst) - return true; - - return false; + return b == bConst; } bool operator==(const ConstantUnion& constant) const @@ -55,23 +50,14 @@ public: switch (type) { case EbtInt: - if (constant.iConst == iConst) - return true; - - break; + return constant.iConst == iConst; case EbtFloat: - if (constant.fConst == fConst) - return true; - - break; + return constant.fConst == fConst; case EbtBool: - if (constant.bConst == bConst) - return true; - - break; + return constant.bConst == bConst; + default: + return false; } - - return false; } bool operator!=(const int i) const @@ -99,21 +85,12 @@ public: assert(type == constant.type); switch (type) { case EbtInt: - if (iConst > constant.iConst) - return true; - - return false; + return iConst > constant.iConst; case EbtFloat: - if (fConst > constant.fConst) - return true; - - return false; + return fConst > constant.fConst; default: - assert(false && "Default missing"); - return false; + return false; // Invalid operation, handled at semantic analysis } - - return false; } bool operator<(const ConstantUnion& constant) const @@ -121,21 +98,12 @@ public: assert(type == constant.type); switch (type) { case EbtInt: - if (iConst < constant.iConst) - return true; - - return false; + return iConst < constant.iConst; case EbtFloat: - if (fConst < constant.fConst) - return true; - - return false; + return fConst < constant.fConst; default: - assert(false && "Default missing"); - return false; + return false; // Invalid operation, handled at semantic analysis } - - return false; } ConstantUnion operator+(const ConstantUnion& constant) const |