Use the same hash for 8 bit strings as in QByteArray

Moc still used a different and quite a bit more complicated
algorithm to hash 8bit strings then QByteArray.

Change-Id: I86efb08d5ab7de1863fc168dcfc73399e72e1331
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2012-09-07 15:11:36 +02:00 committed by Qt by Nokia
parent 6998c4b2ad
commit 8fca1e70e7

View File

@ -72,18 +72,7 @@ struct SubArray
inline uint qHash(const SubArray &key)
{
const uchar *p = reinterpret_cast<const uchar *>(key.array.data() + key.from);
int n = key.len;
uint h = 0;
uint g;
while (n--) {
h = (h << 4) + *p++;
if ((g = (h & 0xf0000000)) != 0)
h ^= g >> 23;
h &= ~g;
}
return h;
return qHash(QLatin1String(key.array.constData() + key.from, key.len));
}