diff --git a/uppsrc/Core/AString.hpp b/uppsrc/Core/AString.hpp index 2eb57e200..75d04698d 100644 --- a/uppsrc/Core/AString.hpp +++ b/uppsrc/Core/AString.hpp @@ -266,8 +266,7 @@ inline bool String0::IsEqual(const char *s) const { // This optimized for comparison with string literals... size_t len = strlen(s); - if(len != GetCount()) return false; - return memcmp(begin(), s, len) == 0; // compiler is happy to optimize memcmp out... + return len == GetCount() && memcmp(begin(), s, len) == 0; // compiler is happy to optimize memcmp out... } force_inline diff --git a/uppsrc/Core/Color.h b/uppsrc/Core/Color.h index 64bd1218d..dea57bd41 100644 --- a/uppsrc/Core/Color.h +++ b/uppsrc/Core/Color.h @@ -13,8 +13,21 @@ inline Stream& operator%(Stream& s, RGBA& c) return s % c.r % c.g % c.b % c.a; } -template <> -String AsString(const RGBA& c); +template <> String AsString(const RGBA& c); + +template<> inline hash_t GetHashValue(const RGBA& a) { return *(dword *)&a; } + +inline bool operator==(const RGBA& a, const RGBA& b) +{ + return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a; +} + +inline bool operator!=(const RGBA& a, const RGBA& b) +{ + return !(a == b); +} + +inline RGBA RGBAZero() { RGBA c; c.r = c.g = c.b = c.a = 0; return c; } #ifndef PLATFORM_WIN32 inline int GetRValue(dword c) { return (byte)(c >> 0); } diff --git a/uppsrc/Core/Topt.h b/uppsrc/Core/Topt.h index 253409b44..07847ccc4 100644 --- a/uppsrc/Core/Topt.h +++ b/uppsrc/Core/Topt.h @@ -420,7 +420,7 @@ unsigned PrimeBound(unsigned i); hash_t memhash(const void *ptr, size_t size); template -inline hash_t GetHashValue(const T& x) { return x.GetHashValue(); } +inline hash_t GetHashValue(const T& x) { return x.GetHashValue(); } struct CombineHash { hash_t hash; diff --git a/uppsrc/Draw/Image.h b/uppsrc/Draw/Image.h index 85884d084..8bb91b2be 100644 --- a/uppsrc/Draw/Image.h +++ b/uppsrc/Draw/Image.h @@ -8,18 +8,6 @@ enum ImageKind { IMAGE_OPAQUE, }; -inline bool operator==(const RGBA& a, const RGBA& b) -{ - return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a; -} - -inline bool operator!=(const RGBA& a, const RGBA& b) -{ - return !(a == b); -} - -inline RGBA RGBAZero() { RGBA c; c.r = c.g = c.b = c.a = 0; return c; } - inline void Fill(RGBA *t, RGBA c, int n) { memset32(t, *(dword *)&c, n); } inline void Copy(RGBA *t, const RGBA *s, int n) { memcpy_t(t, s, n); }