On Tue, 05 Apr 2011 18:38:41 +0300, Erkki Seppala <[email protected]> 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.
--
[email protected]
pgpJWn1xvLfTp.pgp
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
