Bug 551736: Add parens around right-shift, to fix compile warning and make sure we construct hash value correctly. r=sicking

This commit is contained in:
Daniel Holbert 2010-03-11 22:03:49 -08:00
Родитель 51582e89d2
Коммит 7f63efa6df
1 изменённых файлов: 6 добавлений и 3 удалений

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

@ -50,9 +50,12 @@ nsSMILCompositor::KeyEquals(KeyTypePointer aKey) const
/*static*/ PLDHashNumber
nsSMILCompositor::HashKey(KeyTypePointer aKey)
{
// Combine the 3 values into one numeric value, which will be hashed
return NS_PTR_TO_UINT32(aKey->mElement.get()) >> 4 +
NS_PTR_TO_INT32(aKey->mAttributeName.get()) +
// Combine the 3 values into one numeric value, which will be hashed.
// NOTE: We right-shift one of the pointers by 2 to get some randomness in
// its 2 lowest-order bits. (Those shifted-off bits will always be 0 since
// our pointers will be word-aligned.)
return (NS_PTR_TO_UINT32(aKey->mElement.get()) >> 2) +
NS_PTR_TO_UINT32(aKey->mAttributeName.get()) +
(aKey->mIsCSS ? 1 : 0);
}