Use a stack variable for hash computation in GrBinHashKey

Review URL: http://codereview.appspot.com/5484054/



git-svn-id: http://skia.googlecode.com/svn/trunk@2863 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2011-12-12 22:35:18 +00:00
Родитель eb85630fd6
Коммит 6b5fdc1bcf
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -39,24 +39,25 @@ public:
~GrBinHashKey() {
}
void setKeyData(const uint32_t *data) {
void setKeyData(const uint32_t* SK_RESTRICT data) {
GrAssert(GrIsALIGN4(KeySize));
memcpy(&fData, data, KeySize);
fHash = 0;
uint32_t hash = 0;
size_t len = KeySize;
while (len >= 4) {
fHash += *data++;
fHash += (fHash << 10);
fHash ^= (fHash >> 6);
hash += *data++;
hash += (fHash << 10);
hash ^= (hash >> 6);
len -= 4;
}
fHash += (fHash << 3);
fHash ^= (fHash >> 11);
fHash += (fHash << 15);
hash += (fHash << 3);
hash ^= (fHash >> 11);
hash += (fHash << 15);
#if GR_DEBUG
fIsValid = true;
#endif
fHash = hash;
}
int compare(const GrBinHashKey<Entry, KeySize>& key) const {