.cosmetics

git-svn-id: svn://ultimatepp.org/upp/trunk@14565 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-06-07 11:38:43 +00:00
parent 59635c7080
commit 5b4dcd91c7
4 changed files with 17 additions and 17 deletions

View file

@ -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

View file

@ -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); }

View file

@ -420,7 +420,7 @@ unsigned PrimeBound(unsigned i);
hash_t memhash(const void *ptr, size_t size);
template <class T>
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;

View file

@ -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); }