diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-12-12 22:35:18 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-12-12 22:35:18 +0000 |
commit | 6b5fdc1bcfb2280c094474882dc452b398a74cfd (patch) | |
tree | 178eaffd164670e606351c2c5542af3062e01418 /src/gpu | |
parent | eb85630fd6105189df316bd3cde662a616ac1180 (diff) |
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
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrBinHashKey.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gpu/GrBinHashKey.h b/src/gpu/GrBinHashKey.h index ceaef7aa6f..028bb912bb 100644 --- a/src/gpu/GrBinHashKey.h +++ b/src/gpu/GrBinHashKey.h @@ -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 { |