[PULL] [xorg/xserver] XRes v1.2
Keith Packard
keithp at keithp.com
Tue Apr 5 08:58:29 PDT 2011
On Tue, 05 Apr 2011 18:38:41 +0300, Erkki Seppala <erkki.seppala at vincit.fi> wrote:
> On 05.04.2011 17:54, Keith Packard wrote:
> >> Internally resource.c now uses the same static function Hash implemented
> >> in terms of HashResourceID.
> >
> > Please just fix users of the existing 'Hash' function to call
> > HashResourceID directly.
>
> Hm, are you sure? It looks like this afterwards:
The patch I see says:
index 2c5f2bc..7cc8039 100644
@@ -638,12 +638,11 @@ InitClientResources(ClientPtr client)
return TRUE;
}
-
-static int
-Hash(int client, XID id)
+int
+HashResourceID(XID id, int numBits)
{
id &= RESOURCE_ID_MASK;
- switch (clientTable[client].hashsize)
+ switch (numBits)
{
case 6:
return ((int)(0x03F & (id ^ (id>>6) ^ (id>>12))));
@@ -661,6 +660,12 @@ Hash(int client, XID id)
return -1;
}
+static int
+Hash(int client, XID id)
+{
+ return HashResourceID(id, clientTable[client].hashsize);
+}
+
Am I looking at the wrong branch? (this is client-tracking-v2)
> > Or just use case 11: as the default; that would work for any accidental
> > increases in the client hashsize value. What an ugly function. I like to
> > avoid power-of-two hash tables and use prime sizes to ensure reasonable
> > distribution instead of relying on hash value tricks.
>
> That's indeed a better solution for an ugly problem, I'll revise the code.
Sounds good.
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110405/b972a877/attachment.pgp>
More information about the xorg-devel
mailing list