mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
uppsrc: In preparation to move to 64 bit hash codes, hash code type is now hash_t (replaces unsigned, dword)
git-svn-id: svn://ultimatepp.org/upp/trunk@14521 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
80a7a09c67
commit
d2967e13f1
38 changed files with 163 additions and 156 deletions
|
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
void Serialize(Stream& s);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
template <class B> int Compare(const B& b) const { return CompareRanges(*this, b); }
|
||||
|
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
void Serialize(Stream& s);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
template <class B> int Compare(const B& b) const { return CompareRanges(*this, b); }
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
void SetNull() { color = 0xffffffff; }
|
||||
bool IsNullInstance() const { return color == 0xffffffff; }
|
||||
unsigned GetHashValue() const { return color; }
|
||||
hash_t GetHashValue() const { return color; }
|
||||
bool operator==(Color c) const { return color == c.color; }
|
||||
bool operator!=(Color c) const { return color != c.color; }
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ inline Color StraightColor(RGBA rgba) { return Color(rgba.r, rgba.g, rgba.b); }
|
|||
|
||||
typedef Color (*ColorF)();
|
||||
|
||||
inline unsigned GetHashValue(Color c) { return c.GetHashValue(); }
|
||||
inline hash_t GetHashValue(Color c) { return c.GetHashValue(); }
|
||||
inline Color Nvl(Color a, Color b) { return IsNull(a) ? b : a; }
|
||||
|
||||
template<>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ struct Complex : std::complex<double>
|
|||
};
|
||||
|
||||
template<> inline bool IsNull(const Complex& r) { return r.real() < DOUBLE_NULL_LIM || r.imag() < DOUBLE_NULL_LIM; }
|
||||
template<> inline unsigned GetHashValue(const Complex& x) { return CombineHash(x.real(), x.imag()); }
|
||||
template<> inline hash_t GetHashValue(const Complex& x) { return CombineHash(x.real(), x.imag()); }
|
||||
template<> inline String AsString(const std::complex<double>& x) { return String().Cat() << "(" << x.real() << "," << x.imag() << ")"; }
|
||||
template<> inline String AsString(const Complex& x) { return AsString((const std::complex<double>&)x); }
|
||||
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ struct FormId : Moveable<FormId> {
|
|||
int type;
|
||||
};
|
||||
|
||||
unsigned GetHashValue(const FormId& fid)
|
||||
hash_t GetHashValue(const FormId& fid)
|
||||
{
|
||||
return CombineHash(fid.type, GetHashValue(fid.id));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct Size_ : Moveable< Size_<T> > {
|
|||
friend T Squared(Size_ a) { return a.cx * a.cx + a.cy * a.cy; }
|
||||
friend double Length(Size_ a) { return hypot(a.cx, a.cy); }
|
||||
|
||||
unsigned GetHashValue() const { return CombineHash(cx, cy); }
|
||||
hash_t GetHashValue() const { return CombineHash(cx, cy); }
|
||||
|
||||
String ToString() const;
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ struct Point_ : Moveable< Point_<T> > {
|
|||
|
||||
friend Point_ Nvl(Point_ a, Point_ b) { return IsNull(a) ? b : a; }
|
||||
|
||||
unsigned GetHashValue() const { return CombineHash(x, y); }
|
||||
hash_t GetHashValue() const { return CombineHash(x, y); }
|
||||
|
||||
String ToString() const;
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ struct Rect_ : Moveable< Rect_<T> > {
|
|||
|
||||
friend const Rect_& Nvl(const Rect_& a, const Rect_& b) { return IsNull(a) ? b : a; }
|
||||
|
||||
unsigned GetHashValue() const { return CombineHash(left, top, right, bottom); }
|
||||
hash_t GetHashValue() const { return CombineHash(left, top, right, bottom); }
|
||||
|
||||
String ToString() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -132,27 +132,27 @@ public:
|
|||
|
||||
template <class L>
|
||||
int Find(const T& val, const L& less) const;
|
||||
int Find(const T& val) const { return Find(val, StdLess<T>()); }
|
||||
int Find(const T& val) const { return Find(val, StdLess<T>()); }
|
||||
|
||||
ConstIterator begin() const { ConstIterator it; SetBegin(it); return it; }
|
||||
ConstIterator end() const { ConstIterator it; SetEnd(it); return it; }
|
||||
ConstIterator begin() const { ConstIterator it; SetBegin(it); return it; }
|
||||
ConstIterator end() const { ConstIterator it; SetEnd(it); return it; }
|
||||
|
||||
Iterator begin() { Iterator it; SetBegin(it); return it; }
|
||||
Iterator end() { Iterator it; SetEnd(it); return it; }
|
||||
Iterator begin() { Iterator it; SetBegin(it); return it; }
|
||||
Iterator end() { Iterator it; SetEnd(it); return it; }
|
||||
|
||||
InVector();
|
||||
InVector(InVector&& v) { Pick(pick(v)); }
|
||||
void operator=(InVector&& v) { Pick(pick(v)); }
|
||||
InVector(InVector&& v) { Pick(pick(v)); }
|
||||
void operator=(InVector&& v) { Pick(pick(v)); }
|
||||
InVector(const InVector& v, int);
|
||||
InVector(std::initializer_list<T> init) { Init(); for(const auto& i : init) Add(i); }
|
||||
InVector(std::initializer_list<T> init) { Init(); for(const auto& i : init) Add(i); }
|
||||
|
||||
void Swap(InVector& b);
|
||||
|
||||
void Serialize(Stream& s) { StreamContainer(s, *this); }
|
||||
void Serialize(Stream& s) { StreamContainer(s, *this); }
|
||||
void Xmlize(XmlIO& xio, const char *itemtag = "item");
|
||||
void Jsonize(JsonIO& jio);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
template <class B> int Compare(const B& b) const { return CompareRanges(*this, b); }
|
||||
|
|
@ -380,7 +380,7 @@ public:
|
|||
void Xmlize(XmlIO& xio, const char *itemtag = "item");
|
||||
void Jsonize(JsonIO& jio);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
template <class B> int Compare(const B& b) const { return CompareRanges(*this, b); }
|
||||
|
|
@ -525,7 +525,8 @@ public:
|
|||
void Xmlize(XmlIO& xio, const char *itemtag = "key") { iv.Xmlize(xio, itemtag); }
|
||||
void Jsonize(JsonIO& jio) { iv.Jsonize(jio); }
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
template <class B> int Compare(const B& b) const { return CompareRanges(*this, b); }
|
||||
|
|
@ -670,7 +671,7 @@ public:
|
|||
void Serialize(Stream& s);
|
||||
void Xmlize(XmlIO& xio);
|
||||
void Jsonize(JsonIO& jio);
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
#endif
|
||||
|
||||
const InVector<T>& GetValues() const { return B::value.data; }
|
||||
|
|
@ -754,7 +755,7 @@ public:
|
|||
void Serialize(Stream& s);
|
||||
void Xmlize(XmlIO& xio);
|
||||
void Jsonize(JsonIO& jio);
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
#endif
|
||||
|
||||
void Swap(SortedArrayMap& x);
|
||||
|
|
|
|||
|
|
@ -160,45 +160,4 @@ void IndexCommon::Sweep(int n)
|
|||
unlinked = -1;
|
||||
}
|
||||
|
||||
#ifdef CPU_UNALIGNED
|
||||
|
||||
NOUBSAN // CPU supports unaligned memory access
|
||||
unsigned memhash(const void *ptr, size_t count)
|
||||
{
|
||||
unsigned hash = 1234567890U;
|
||||
|
||||
const unsigned *ds = (unsigned *)ptr;
|
||||
const unsigned *de = ds + (count >> 2);
|
||||
while(ds < de)
|
||||
hash = ((hash << 5) - hash) ^ *ds++;
|
||||
|
||||
const byte *s = (byte *)ds;
|
||||
const byte *e = s + (count & 3);
|
||||
while(s < e)
|
||||
hash = ((hash << 5) - hash) ^ *s++;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
unsigned memhash(const void *ptr, size_t count)
|
||||
{
|
||||
unsigned hash = 1234567890U;
|
||||
|
||||
const byte *s = (byte *)ptr;
|
||||
const byte *e = s + count;
|
||||
while(s < e)
|
||||
hash = ((hash << 5) - hash) ^ *s++;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
unsigned GetHashValue0(const double& d)
|
||||
{
|
||||
return memhash(&d, sizeof(double));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ public:
|
|||
void Xmlize(XmlIO& xio);
|
||||
void Jsonize(JsonIO& jio);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
bool operator==(const AMap& b) const { ASSERT(!HasUnlinked()); return IsEqualMap(*this, b); }
|
||||
bool operator!=(const AMap& b) const { return !operator==(b); }
|
||||
int Compare(const AMap& b) const { ASSERT(!HasUnlinked()); return CompareMap(*this, b); }
|
||||
|
|
|
|||
|
|
@ -614,3 +614,39 @@ int inline_memcmp_aligned(const char *a, const char *b, size_t len)
|
|||
return memcmp(a, b, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CPU_UNALIGNED
|
||||
|
||||
NOUBSAN // CPU supports unaligned memory access
|
||||
inline hash_t memhash(const void *ptr, size_t count)
|
||||
{
|
||||
unsigned hash = 1234567890U;
|
||||
|
||||
const unsigned *ds = (unsigned *)ptr;
|
||||
const unsigned *de = ds + (count >> 2);
|
||||
while(ds < de)
|
||||
hash = ((hash << 5) - hash) ^ *ds++;
|
||||
|
||||
const byte *s = (byte *)ds;
|
||||
const byte *e = s + (count & 3);
|
||||
while(s < e)
|
||||
hash = ((hash << 5) - hash) ^ *s++;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline hash_t memhash(const void *ptr, size_t count)
|
||||
{
|
||||
unsigned hash = 1234567890U;
|
||||
|
||||
const byte *s = (byte *)ptr;
|
||||
const byte *e = s + count;
|
||||
while(s < e)
|
||||
hash = ((hash << 5) - hash) ^ *s++;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -150,11 +150,18 @@ void EndianSwap(int *v, size_t count);
|
|||
void EndianSwap(int64 *v, size_t count);
|
||||
void EndianSwap(uint64 *v, size_t count);
|
||||
|
||||
|
||||
typedef dword hash_t;
|
||||
|
||||
inline dword FoldHash(dword h)
|
||||
{
|
||||
return SwapEndian32(0xa3613c16 * h);
|
||||
}
|
||||
|
||||
#define HASH64_CONST1 I64(0xf7c21089bee7c0a5)
|
||||
#define HASH64_CONST2 I64(0xc85abc8da7534a4d)
|
||||
#define HASH64_CONST3 I64(0x8642b0fe3e86671b)
|
||||
|
||||
force_inline
|
||||
int SignificantBits(dword x)
|
||||
{ // basically log2(x) + 1 except that for 0 this is 0, number of significant bits of x
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ private:
|
|||
const void *type;
|
||||
|
||||
bool operator==(const Key& b) const { return key == b.key && type == b.type; }
|
||||
unsigned GetHashValue() const { return CombineHash(key, (uintptr_t)type); }
|
||||
hash_t GetHashValue() const { return CombineHash(key, (uintptr_t)type); }
|
||||
};
|
||||
|
||||
Index<Key> key;
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ struct SpellKey : Moveable<SpellKey> {
|
|||
int lang;
|
||||
WString wrd;
|
||||
|
||||
unsigned GetHashValue() const { return CombineHash(lang, wrd); }
|
||||
hash_t GetHashValue() const { return CombineHash(lang, wrd); }
|
||||
bool operator==(const SpellKey& b) const { return lang == b.lang && wrd == b.wrd; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ bool String0::LEq(const String0& s) const
|
|||
return l == s.GetCount() && inline_memeq8_aligned(begin(), s.begin(), l);
|
||||
}
|
||||
|
||||
unsigned String0::LHashValue() const
|
||||
hash_t String0::LHashValue() const
|
||||
{
|
||||
int l = LLen();
|
||||
if(l < 15) {
|
||||
if(l < 15) { // must be the same as small hash
|
||||
dword w[4];
|
||||
w[0] = w[1] = w[2] = w[3] = 0;
|
||||
memcpy8((char *)w, ptr, l);
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ class String0 : Moveable<String0> {
|
|||
void LSet(const String0& s);
|
||||
void LFree();
|
||||
void LCat(int c);
|
||||
unsigned LHashValue() const;
|
||||
hash_t LHashValue() const;
|
||||
|
||||
void UnShare();
|
||||
void SetSLen(int l);
|
||||
|
|
@ -285,7 +285,7 @@ public:
|
|||
|
||||
int Compare(const String0& s) const;
|
||||
|
||||
unsigned GetHashValue() const {
|
||||
hash_t GetHashValue() const {
|
||||
return chr[KIND] ? LHashValue() : (unsigned)CombineHash(w[0], w[1], w[2], w[3]);
|
||||
}
|
||||
|
||||
|
|
@ -598,7 +598,7 @@ template<>
|
|||
inline String AsString(const String& s) { return s; }
|
||||
|
||||
template<>
|
||||
inline unsigned GetHashValue(const String& s) { return s.GetHashValue(); }
|
||||
inline hash_t GetHashValue(const String& s) { return s.GetHashValue(); }
|
||||
|
||||
int CompareNoCase(const String& a, const String& b, byte encoding = 0);
|
||||
int CompareNoCase(const String& a, const char *b, byte encoding = 0);
|
||||
|
|
@ -755,7 +755,7 @@ public:
|
|||
int GetLength() const { return length; }
|
||||
int GetAlloc() const { return alloc; }
|
||||
|
||||
unsigned GetHashValue() const { return memhash(ptr, length * sizeof(wchar)); }
|
||||
hash_t GetHashValue() const { return memhash(ptr, length * sizeof(wchar)); }
|
||||
bool IsEqual(const WString0& s) const { return s.length == length && memeq16(ptr, s.ptr, length); }
|
||||
int Compare(const WString0& s) const;
|
||||
|
||||
|
|
@ -898,7 +898,7 @@ inline bool IsNull(const WString& s) { return s.IsEmpty(); }
|
|||
//inline String AsString(const WString& s) { return s; }
|
||||
|
||||
template<>
|
||||
inline unsigned GetHashValue(const WString& s) { return memhash(~s, 2 * s.GetLength()); }
|
||||
inline hash_t GetHashValue(const WString& s) { return memhash(~s, 2 * s.GetLength()); }
|
||||
|
||||
WString TrimLeft(const WString& str);
|
||||
WString TrimRight(const WString& s);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct Date : RelOps< Date, Moveable<Date> > {
|
|||
Date(int y, int m, int d) { day = d; month = m; year = y; }
|
||||
};
|
||||
|
||||
inline unsigned GetHashValue(Date t) {
|
||||
inline hash_t GetHashValue(Date t) {
|
||||
return 512 * t.year + 32 * t.month + t.day;
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ inline Time ToTime(const Date& d) {
|
|||
return Time(d.year, d.month, d.day);
|
||||
}
|
||||
|
||||
inline unsigned GetHashValue(Time t) {
|
||||
inline hash_t GetHashValue(Time t) {
|
||||
return t.second +
|
||||
32 * (t.minute + 32 * (t.hour + 16 * (t.day + 32 * (t.month + 8 * t.year))));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -417,20 +417,24 @@ public:
|
|||
unsigned Pow2Bound(unsigned i);
|
||||
unsigned PrimeBound(unsigned i);
|
||||
|
||||
unsigned memhash(const void *ptr, size_t size);
|
||||
hash_t memhash(const void *ptr, size_t size);
|
||||
|
||||
template <class T>
|
||||
inline unsigned GetHashValue(const T& x) { return x.GetHashValue(); }
|
||||
inline hash_t GetHashValue(const T& x) { return x.GetHashValue(); }
|
||||
|
||||
struct CombineHash {
|
||||
unsigned hash;
|
||||
hash_t hash;
|
||||
|
||||
template <class T> CombineHash& Do(const T& x) { Put(GetHashValue(x)); return *this; }
|
||||
|
||||
public:
|
||||
CombineHash& Put(unsigned h) { hash = (0xacf34ce7 * hash) ^ h; return *this; }
|
||||
#ifdef HASH64
|
||||
CombineHash& Put(hash_t h) { hash = (0xacf34ce7bcf34ce7 * hash) ^ h; return *this; }
|
||||
#else
|
||||
CombineHash& Put(hash_t h) { hash = (0xacf34ce7 * hash) ^ h; return *this; }
|
||||
#endif
|
||||
|
||||
operator unsigned() const { return hash; }
|
||||
operator hash_t() const { return hash; }
|
||||
|
||||
CombineHash() { hash = 0; }
|
||||
template <class T>
|
||||
|
|
@ -445,34 +449,33 @@ public:
|
|||
template <class T> CombineHash& operator<<(const T& x) { Do(x); return *this; }
|
||||
};
|
||||
|
||||
template<> inline unsigned GetHashValue(const char& a) { return (unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const signed char& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const unsigned char& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const short& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const unsigned short& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const int& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const unsigned int& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const long& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const unsigned long& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const bool& a) { return (const unsigned)a; }
|
||||
template<> inline unsigned GetHashValue(const wchar_t& a) { return (const unsigned)a; }
|
||||
template<> inline hash_t GetHashValue(const char& a) { return (hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const signed char& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const unsigned char& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const short& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const unsigned short& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const int& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const unsigned int& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const long& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const unsigned long& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const bool& a) { return (const hash_t)a; }
|
||||
template<> inline hash_t GetHashValue(const wchar_t& a) { return (const hash_t)a; }
|
||||
|
||||
template<> inline unsigned GetHashValue(const int64& a) { return CombineHash((unsigned)a, (unsigned)(a >> 32)); }
|
||||
template<> inline unsigned GetHashValue(const uint64& a) { return GetHashValue((int64)a); }
|
||||
// TODO: fix for CPU64
|
||||
template<> inline hash_t GetHashValue(const int64& a) { return CombineHash((hash_t)a, (hash_t)(a >> 32)); }
|
||||
template<> inline hash_t GetHashValue(const uint64& a) { return GetHashValue((int64)a); }
|
||||
|
||||
unsigned GetHashValue0(const double& a);
|
||||
|
||||
template<> inline unsigned GetHashValue(const double& a) { return GetHashValue0(a); }
|
||||
template<> inline unsigned GetHashValue(const float& a) { double x = a; return GetHashValue0(x); }
|
||||
template<> inline hash_t GetHashValue(const double& a) { return memhash(&a, sizeof(a)); }
|
||||
//template<> inline hash_t GetHashValue(const float& a) { double memhash(&a, sizeof(a)); }
|
||||
|
||||
#ifdef CPU_32
|
||||
inline unsigned GetPtrHashValue(const void *a) { return (int)a; }
|
||||
inline hash_t GetPtrHashValue(const void *a) { return (int)a; }
|
||||
#else
|
||||
inline unsigned GetPtrHashValue(const void *a) { return CombineHash((unsigned)(uintptr_t)a); }
|
||||
inline hash_t GetPtrHashValue(const void *a) { return CombineHash((hash_t)(uintptr_t)a); }
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline unsigned GetHashValue(T *ptr) { return GetPtrHashValue(reinterpret_cast<const void *>(ptr)); }
|
||||
inline hash_t GetHashValue(T *ptr) { return GetPtrHashValue(reinterpret_cast<const void *>(ptr)); }
|
||||
|
||||
template <int size>
|
||||
struct Data_S_ : Moveable< Data_S_<size> >
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public:
|
|||
bool operator<(const Tuple& x) const { return Compare(x) < 0; }
|
||||
bool operator>(const Tuple& x) const { return Compare(x) > 0; }
|
||||
|
||||
unsigned GetHashValue() const { CombineHash h; Base::ToHash(h); return h; }
|
||||
hash_t GetHashValue() const { CombineHash h; Base::ToHash(h); return h; }
|
||||
|
||||
void Serialize(Stream& s) { Base::Serialize(s); }
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct Uuid : AssignValueTypeNo<Uuid, 50, Moveable<Uuid> > {
|
|||
Uuid(const Nuller&) { SetNull(); }
|
||||
Uuid() {}
|
||||
|
||||
unsigned GetHashValue() const { return CombineHash(v[0], v[1]); }
|
||||
hash_t GetHashValue() const { return CombineHash(v[0], v[1]); }
|
||||
String ToString() const;
|
||||
String ToStringWithDashes() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const Nuller Null;
|
|||
ValueTypeError::ValueTypeError(const String& text, const Value& src, int target)
|
||||
: Exc(text), src(src), target(target) {}
|
||||
|
||||
unsigned Value::GetOtherHashValue() const {
|
||||
hash_t Value::GetOtherHashValue() const {
|
||||
if(IsNull())
|
||||
return 0;
|
||||
byte st = data.GetSt();
|
||||
|
|
@ -265,7 +265,7 @@ struct SvoVoidFn {
|
|||
static void Serialize(void *p, Stream& s) {}
|
||||
static void Xmlize(void *p, XmlIO& xio) {}
|
||||
static void Jsonize(void *p, JsonIO& jio) {}
|
||||
static unsigned GetHashValue(const void *p) { return 0; }
|
||||
static hash_t GetHashValue(const void *p) { return 0; }
|
||||
static bool IsEqual(const void *p1, const void *p2) { return true; }
|
||||
static bool IsPolyEqual(const void *p, const Value& v) { return false; }
|
||||
static String AsString(const void *p) { return String(); }
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
void Serialize(Stream& s) { NEVER(); }
|
||||
void Xmlize(XmlIO& xio) { NEVER(); }
|
||||
void Jsonize(JsonIO& jio) { NEVER(); }
|
||||
unsigned GetHashValue() const { return 0; }
|
||||
hash_t GetHashValue() const { return 0; }
|
||||
bool operator==(const T&) const { NEVER(); return false; }
|
||||
String ToString() const { return typeid(T).name(); }
|
||||
int Compare(const T&) const { NEVER(); return 0; }
|
||||
|
|
@ -90,7 +90,7 @@ public:
|
|||
virtual void Serialize(Stream& s) {}
|
||||
virtual void Xmlize(XmlIO& xio) {}
|
||||
virtual void Jsonize(JsonIO& jio) {}
|
||||
virtual unsigned GetHashValue() const { return 0; }
|
||||
virtual hash_t GetHashValue() const { return 0; }
|
||||
virtual bool IsEqual(const Void *p) { return false; }
|
||||
virtual bool IsPolyEqual(const Value& v) { return false; }
|
||||
virtual String AsString() const { return ""; }
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
void (*Serialize)(void *p, Stream& s);
|
||||
void (*Xmlize)(void *p, XmlIO& xio);
|
||||
void (*Jsonize)(void *p, JsonIO& jio);
|
||||
unsigned (*GetHashValue)(const void *p);
|
||||
hash_t (*GetHashValue)(const void *p);
|
||||
bool (*IsEqual)(const void *p1, const void *p2);
|
||||
bool (*IsPolyEqual)(const void *p, const Value& v);
|
||||
String (*AsString)(const void *p);
|
||||
|
|
@ -162,7 +162,7 @@ protected:
|
|||
Date GetOtherDate() const;
|
||||
Time GetOtherTime() const;
|
||||
String GetOtherString() const;
|
||||
unsigned GetOtherHashValue() const;
|
||||
hash_t GetOtherHashValue() const;
|
||||
|
||||
bool IsPolyEqual(const Value& v) const;
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ public:
|
|||
void Xmlize(XmlIO& xio);
|
||||
void Jsonize(JsonIO& jio);
|
||||
|
||||
unsigned GetHashValue() const;
|
||||
hash_t GetHashValue() const;
|
||||
|
||||
Value& operator=(const Value& v);
|
||||
Value(const Value& v);
|
||||
|
|
@ -326,7 +326,7 @@ inline bool IsPolyEqual(const T& x, const Value& v) {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline unsigned ValueGetHashValue(const T& x) {
|
||||
inline hash_t ValueGetHashValue(const T& x) {
|
||||
return UPP::GetHashValue(x);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,29 +90,29 @@ inline int PolyCompare(const Time& x, const Value& v) {
|
|||
}
|
||||
|
||||
template<>
|
||||
inline unsigned ValueGetHashValue(const bool& x) {
|
||||
inline hash_t ValueGetHashValue(const bool& x) {
|
||||
return UPP::GetHashValue((int64)x);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned ValueGetHashValue(const int& x) {
|
||||
inline hash_t ValueGetHashValue(const int& x) {
|
||||
return UPP::GetHashValue((int64)x);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned ValueGetHashValue(const double& x) {
|
||||
inline hash_t ValueGetHashValue(const double& x) {
|
||||
if(x >= (double)INT64_MIN && x <= (double)INT64_MAX && (int64)x == x)
|
||||
return UPP::GetHashValue((int64)x);
|
||||
return UPP::GetHashValue((int64)x); // we want this to be equal to other number types
|
||||
return UPP::GetHashValue(x);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned ValueGetHashValue(const Date& x) {
|
||||
inline hash_t ValueGetHashValue(const Date& x) {
|
||||
return UPP::GetHashValue(ToTime(x));
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned ValueGetHashValue(const WString& x) {
|
||||
inline hash_t ValueGetHashValue(const WString& x) {
|
||||
return UPP::GetHashValue(x.ToString());
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ public:
|
|||
virtual void Serialize(Stream& s) { s % this->v; }
|
||||
virtual void Xmlize(XmlIO& xio) { Upp::Xmlize(xio, this->v); }
|
||||
virtual void Jsonize(JsonIO& jio) { Upp::Jsonize(jio, this->v); }
|
||||
virtual unsigned GetHashValue() const { return UPP::ValueGetHashValue(this->v); }
|
||||
virtual hash_t GetHashValue() const { return UPP::ValueGetHashValue(this->v); }
|
||||
virtual bool IsEqual(const Value::Void *p) { ASSERT(dynamic_cast<const RawValueRep<T> *>(p));
|
||||
return static_cast<const RawValueRep<T> *>(p)->Get() == this->v; }
|
||||
virtual bool IsPolyEqual(const Value& b) { return UPP::IsPolyEqual(this->v, b); }
|
||||
|
|
@ -163,7 +163,7 @@ struct SvoFn {
|
|||
static void Serialize(void *p, Stream& s) { s % *(T*)p; }
|
||||
static void Xmlize(void *p, XmlIO& xio) { Upp::Xmlize(xio, *(T*)p); }
|
||||
static void Jsonize(void *p, JsonIO& jio) { Upp::Jsonize(jio, *(T*)p); }
|
||||
static unsigned GetHashValue(const void *p) { return UPP::ValueGetHashValue(*(T*)p); }
|
||||
static hash_t GetHashValue(const void *p) { return UPP::ValueGetHashValue(*(T*)p); }
|
||||
static bool IsEqual(const void *p1, const void *p2) { return *(T*)p1 == *(T*)p2; }
|
||||
static bool IsPolyEqual(const void *p, const Value& v) { return UPP::IsPolyEqual(*(T*)p, v); }
|
||||
static String AsString(const void *p) { return UPP::AsString(*(T*)p); }
|
||||
|
|
@ -314,7 +314,7 @@ Value::Value(const T& x, VSMALL)
|
|||
}
|
||||
|
||||
inline
|
||||
unsigned Value::GetHashValue() const
|
||||
hash_t Value::GetHashValue() const
|
||||
{
|
||||
return IsString() ? data.GetCount() ? data.GetHashValue() : 0
|
||||
: GetOtherHashValue();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void ValueArray::Data::Xmlize(XmlIO& io)
|
|||
Upp::Xmlize(io, data);
|
||||
}
|
||||
|
||||
unsigned ValueArray::Data::GetHashValue() const
|
||||
hash_t ValueArray::Data::GetHashValue() const
|
||||
{
|
||||
CombineHash w(data.GetCount());
|
||||
for(int i = 0; i < data.GetCount(); i++)
|
||||
|
|
@ -333,7 +333,7 @@ void ValueMap::Data::Jsonize(JsonIO& jio)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned ValueMap::Data::GetHashValue() const {
|
||||
hash_t ValueMap::Data::GetHashValue() const {
|
||||
CombineHash w(key.GetCount());
|
||||
for(int i = 0; i < key.GetCount(); i++)
|
||||
w.Put(key[i].GetHashValue());
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class Id : Moveable<Id> {
|
|||
|
||||
public:
|
||||
const String& ToString() const { return id; }
|
||||
dword GetHashValue() const { return UPP::GetHashValue(id); }
|
||||
hash_t GetHashValue() const { return UPP::GetHashValue(id); }
|
||||
bool IsNull() const { return UPP::IsNull(id); }
|
||||
|
||||
operator const String&() const { return ToString(); }
|
||||
|
|
@ -205,7 +205,7 @@ class ValueArray : public ValueType<ValueArray, VALUEARRAY_V, Moveable<ValueArra
|
|||
virtual void Serialize(Stream& s);
|
||||
virtual void Xmlize(XmlIO& xio);
|
||||
virtual void Jsonize(JsonIO& jio);
|
||||
virtual unsigned GetHashValue() const;
|
||||
virtual hash_t GetHashValue() const;
|
||||
virtual bool IsEqual(const Value::Void *p);
|
||||
virtual String AsString() const;
|
||||
virtual int Compare(const Value::Void *p);
|
||||
|
|
@ -269,7 +269,7 @@ public:
|
|||
|
||||
Value& At(int i);
|
||||
|
||||
unsigned GetHashValue() const { return data->GetHashValue(); }
|
||||
hash_t GetHashValue() const { return data->GetHashValue(); }
|
||||
void Serialize(Stream& s);
|
||||
void Jsonize(JsonIO& jio);
|
||||
void Xmlize(XmlIO& xio);
|
||||
|
|
@ -307,7 +307,7 @@ class ValueMap : public ValueType<ValueMap, VALUEMAP_V, Moveable<ValueMap> >{
|
|||
virtual void Serialize(Stream& s);
|
||||
virtual void Xmlize(XmlIO& xio);
|
||||
virtual void Jsonize(JsonIO& jio);
|
||||
virtual unsigned GetHashValue() const;
|
||||
virtual hash_t GetHashValue() const;
|
||||
virtual bool IsEqual(const Value::Void *p);
|
||||
virtual String AsString() const;
|
||||
virtual int Compare(const Value::Void *p);
|
||||
|
|
@ -430,7 +430,7 @@ public:
|
|||
|
||||
Value GetAndClear(const Value& key);
|
||||
|
||||
unsigned GetHashValue() const { return data->GetHashValue(); }
|
||||
hash_t GetHashValue() const { return data->GetHashValue(); }
|
||||
void Serialize(Stream& s);
|
||||
void Jsonize(JsonIO& jio);
|
||||
void Xmlize(XmlIO& xio);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public:
|
|||
void Xmlize(XmlIO& xio, const char *itemtag = "item");
|
||||
void Jsonize(JsonIO& jio);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
template <class B> int Compare(const B& b) const { return CompareRanges(*this, b); }
|
||||
|
|
@ -352,7 +352,7 @@ public:
|
|||
void Xmlize(XmlIO& xio, const char *itemtag = "item");
|
||||
void Jsonize(JsonIO& jio);
|
||||
String ToString() const;
|
||||
dword GetHashValue() const { return HashBySerialize(*this); }
|
||||
hash_t GetHashValue() const { return HashBySerialize(*this); }
|
||||
|
||||
template <class B> bool operator==(const B& b) const { return IsEqualRange(*this, b); }
|
||||
template <class B> bool operator!=(const B& b) const { return !operator==(b); }
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void StreamContainer(Stream& s, T& cont)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
dword HashBySerialize(const T& cont)
|
||||
hash_t HashBySerialize(const T& cont)
|
||||
{
|
||||
TimeStop tm;
|
||||
xxHashStream xxh;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
topic "String and WString";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,0#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
|
|
@ -9,6 +8,7 @@ topic "String and WString";
|
|||
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
|
||||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[{_}%EN-US
|
||||
[ {{10000@(113.42.0) [s0; [*@7;4 String]]}}&]
|
||||
[s3; &]
|
||||
|
|
@ -409,7 +409,7 @@ grows exponentially, like with Vector or std`::vector).&]
|
|||
contain zero characters).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:WString0`:`:GetHashValue`(`)const:%- [@(0.0.255) unsigned]_[* GetHashValue]()_[@(0.0.255) c
|
||||
[s5;:WString0`:`:GetHashValue`(`)const:%- [@(0.0.255) hash`_t]_[* GetHashValue]()_[@(0.0.255) c
|
||||
onst]&]
|
||||
[s2; Returns the hash value of the string.&]
|
||||
[s3;%- &]
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static bool sIdEq(const char *a, const char *b)
|
|||
struct CharS : Moveable<CharS> {
|
||||
const char *s;
|
||||
|
||||
unsigned GetHashValue() const { return memhash(s, sIdLen(s)); }
|
||||
hash_t GetHashValue() const { return memhash(s, sIdLen(s)); }
|
||||
bool operator==(const CharS& b) const { return sIdEq(s, b.s); }
|
||||
};
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ char *ZoneAlloc::Alloc(int sz)
|
|||
}
|
||||
|
||||
template<>
|
||||
inline unsigned GetHashValue(const char * const &s)
|
||||
inline hash_t GetHashValue(const char * const &s)
|
||||
{
|
||||
return GetPtrHashValue(s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1371,9 +1371,9 @@ inline Ctrl *operator<<(Ctrl *parent, Ctrl& child)
|
|||
return parent;
|
||||
}
|
||||
|
||||
inline unsigned GetHashValue(Ctrl *x)
|
||||
inline hash_t GetHashValue(Ctrl *x)
|
||||
{
|
||||
return (unsigned)(intptr_t)x;
|
||||
return (hash_t)(intptr_t)x;
|
||||
}
|
||||
|
||||
String GetKeyDesc(dword key);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ inline int s255d16(int x)
|
|||
|
||||
static XPicture sGetSolidFill(Color c)
|
||||
{
|
||||
int q = GetHashValue(c) % (int)XRSolidFillCount;
|
||||
int q = FoldHash(GetHashValue(c)) % (int)XRSolidFillCount;
|
||||
XRSolidFill& f = sFill[q];
|
||||
if(f.color == c && f.picture)
|
||||
return f.picture;
|
||||
|
|
|
|||
|
|
@ -346,9 +346,9 @@ public:
|
|||
|
||||
namespace Upp {
|
||||
|
||||
inline unsigned GetHashValue(const HWND& hwnd)
|
||||
inline hash_t GetHashValue(const HWND& hwnd)
|
||||
{
|
||||
return (unsigned)(intptr_t)hwnd;
|
||||
return (hash_t)(intptr_t)hwnd;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ namespace Upp {
|
|||
#define ELOG(x) // RLOG(GetSysTime() << ": " << x)
|
||||
|
||||
template<>
|
||||
unsigned GetHashValue(const HWND& h)
|
||||
hash_t GetHashValue(const HWND& h)
|
||||
{
|
||||
return (unsigned)(intptr_t)h;
|
||||
return (hash_t)(intptr_t)h;
|
||||
}
|
||||
|
||||
bool Ctrl::GetMsg(MSG& msg)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct XpElement : Moveable<XpElement> {
|
|||
return e.widget == widget && e.part == part && e.state == state;
|
||||
}
|
||||
|
||||
unsigned GetHashValue() const { return widget ^ part ^ state; }
|
||||
hash_t GetHashValue() const { return widget ^ part ^ state; }
|
||||
|
||||
XpElement() { contentm = whista = false; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@ struct AttrText : public ValueType<AttrText, 151, Moveable<AttrText> > {
|
|||
bool operator==(const AttrText& f) const;
|
||||
bool operator!=(const AttrText& f) const { return !operator==(f); }
|
||||
|
||||
dword GetHashValue() const { return CombineHash(text, font, ink, paper); }
|
||||
bool IsNullInstance() const { return IsNull(text); }
|
||||
void SetNull() { Init(); img = Null; text = Null; }
|
||||
hash_t GetHashValue() const { return CombineHash(text, font, ink, paper); }
|
||||
bool IsNullInstance() const { return IsNull(text); }
|
||||
void SetNull() { Init(); img = Null; text = Null; }
|
||||
|
||||
String ToString() const { return AsString(value); }
|
||||
int Compare(const AttrText& x) const { return value.Compare(x.value); }
|
||||
|
|
|
|||
|
|
@ -193,9 +193,9 @@ public:
|
|||
v.width == f.v.width && v.height == f.v.height; }
|
||||
bool operator!=(Font f) const { return !operator==(f); }
|
||||
|
||||
dword GetHashValue() const { return CombineHash(v.width, v.flags, v.height, v.face); }
|
||||
bool IsNullInstance() const { return v.face == 0xffff; }
|
||||
void SetNull() { v.face = 0xffff; v.height = v.width = 0; v.flags = 0; }
|
||||
hash_t GetHashValue() const { return CombineHash(v.width, v.flags, v.height, v.face); }
|
||||
bool IsNullInstance() const { return v.face == 0xffff; }
|
||||
void SetNull() { v.face = 0xffff; v.height = v.width = 0; v.flags = 0; }
|
||||
Font() { v.height = v.width = 0; v.face = v.flags = 0; }
|
||||
Font(int face, int height) { v.face = face; v.height = height; v.flags = 0; v.width = 0; }
|
||||
Font(const Nuller&) { SetNull(); }
|
||||
|
|
@ -394,7 +394,7 @@ public:
|
|||
bool IsNullInstance() const { return cmd.IsEmpty(); }
|
||||
void SetNull() { size = Null; }
|
||||
bool operator==(const Painting& b) const { return cmd == b.cmd && data == b.data && size == b.size; }
|
||||
unsigned GetHashValue() const { return CombineHash(cmd, data); }
|
||||
hash_t GetHashValue() const { return CombineHash(cmd, data); }
|
||||
String ToString() const { return "painting " + AsString(size); }
|
||||
|
||||
operator Value() const { return RichToValue(*this); }
|
||||
|
|
@ -668,7 +668,7 @@ public:
|
|||
|
||||
bool operator==(const Drawing& b) const { return val == b.val && data == b.data && size == b.size; }
|
||||
String ToString() const { return "drawing " + AsString(size); }
|
||||
unsigned GetHashValue() const { return CombineHash(data, val); }
|
||||
hash_t GetHashValue() const { return CombineHash(data, val); }
|
||||
|
||||
operator Value() const { return RichToValue(*this); }
|
||||
Drawing(const Value& src) { *this = src.Get<Drawing>(); }
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ struct CharEntry {
|
|||
|
||||
CharEntry fc_cache_global[4093];
|
||||
|
||||
inline dword GlyphHash(Font font, int chr)
|
||||
inline hash_t GlyphHash(Font font, int chr)
|
||||
{
|
||||
return FoldHash(CombineHash(font.GetHashValue(), chr));
|
||||
}
|
||||
|
|
@ -455,7 +455,7 @@ thread_local FontEntry fi_cache[63];
|
|||
const CommonFontInfo& GetFontInfo(Font font)
|
||||
{
|
||||
font.RealizeStd();
|
||||
unsigned hash = FoldHash(font.GetHashValue()) % 63;
|
||||
dword hash = FoldHash(font.GetHashValue()) % 63;
|
||||
FontEntry& e = fi_cache[hash];
|
||||
if(e.font != font.AsInt64()) {
|
||||
Mutex::Lock __(sFontLock);
|
||||
|
|
|
|||
|
|
@ -272,13 +272,14 @@ INITBLOCK {
|
|||
|
||||
bool Image::operator==(const Image& img) const
|
||||
{
|
||||
static_assert(sizeof(RGBA) == 4, "sizeof(RGBA)");
|
||||
return IsSame(img) ||
|
||||
GetSize() == img.GetSize() &&
|
||||
GetHotSpot() == img.GetHotSpot() &&
|
||||
Get2ndSpot() == img.Get2ndSpot() &&
|
||||
GetDots() == img.GetDots() &&
|
||||
GetResolution() == img.GetResolution() &&
|
||||
memcmp(~*this, ~img, GetLength() * sizeof(RGBA)) == 0;
|
||||
memeq32(~*this, ~img, GetLength() * sizeof(RGBA));
|
||||
}
|
||||
|
||||
bool Image::operator!=(const Image& img) const
|
||||
|
|
@ -286,7 +287,7 @@ bool Image::operator!=(const Image& img) const
|
|||
return !operator==(img);
|
||||
}
|
||||
|
||||
dword Image::GetHashValue() const
|
||||
hash_t Image::GetHashValue() const
|
||||
{
|
||||
return memhash(~*this, GetLength() * sizeof(RGBA));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public:
|
|||
|
||||
bool operator==(const Image& img) const;
|
||||
bool operator!=(const Image& img) const;
|
||||
dword GetHashValue() const;
|
||||
hash_t GetHashValue() const;
|
||||
String ToString() const;
|
||||
|
||||
void Serialize(Stream& s);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct GlyphKey {
|
|||
bool operator==(const GlyphKey& b) const {
|
||||
return fnt == b.fnt && chr == b.chr && tolerance == b.tolerance;
|
||||
}
|
||||
unsigned GetHashValue() const {
|
||||
hash_t GetHashValue() const {
|
||||
return CombineHash(fnt, chr, tolerance);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue