From 96e46e00ab1f7400f5a5c14c658705d9a9bcd1fa Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Sun, 2 May 2004 19:56:06 +0000 Subject: [PATCH] Minor tweak to hashkey calculation. Bug 240934. git-svn-id: svn://10.0.0.236/trunk@155840 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresShell.cpp | 9 +++++---- mozilla/layout/html/base/src/nsPresShell.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 17aff9f139c..4600b355aaf 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -1031,11 +1031,12 @@ ReflowCommandHashHashKey(PLDHashTable *table, const void *key) const nsHTMLReflowCommand* command = NS_STATIC_CAST(const nsHTMLReflowCommand*, key); - // The target is going to be reasonbly unique, the type comes from an enum - // and we just don't have that many types, and the child list name is either - // null or has the same high-order bits as all the other child list names. + // The target is going to be reasonably unique, if we shift out the + // always-zero low-order bits, the type comes from an enum and we just don't + // have that many types, and the child list name is either null or has the + // same high-order bits as all the other child list names. return - NS_PTR_TO_INT32(command->GetTarget()) ^ + (NS_PTR_TO_INT32(command->GetTarget()) >> 2) ^ (command->GetType() << 17) ^ (NS_PTR_TO_INT32(command->GetChildListName()) << 20); } diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 17aff9f139c..4600b355aaf 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -1031,11 +1031,12 @@ ReflowCommandHashHashKey(PLDHashTable *table, const void *key) const nsHTMLReflowCommand* command = NS_STATIC_CAST(const nsHTMLReflowCommand*, key); - // The target is going to be reasonbly unique, the type comes from an enum - // and we just don't have that many types, and the child list name is either - // null or has the same high-order bits as all the other child list names. + // The target is going to be reasonably unique, if we shift out the + // always-zero low-order bits, the type comes from an enum and we just don't + // have that many types, and the child list name is either null or has the + // same high-order bits as all the other child list names. return - NS_PTR_TO_INT32(command->GetTarget()) ^ + (NS_PTR_TO_INT32(command->GetTarget()) >> 2) ^ (command->GetType() << 17) ^ (NS_PTR_TO_INT32(command->GetChildListName()) << 20); }