From: Nicholas Clark Date: Fri, 9 Dec 2005 23:09:42 +0000 (+0000) Subject: A better hash for PTR_TABLE_HASH (?) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7119fd33ffc5ef947b59b6096cf5249ee05d4397;p=p5sagit%2Fp5-mst-13.2.git A better hash for PTR_TABLE_HASH (?) p4raw-id: //depot/perl@26315 --- diff --git a/sv.c b/sv.c index 9ed37cb..30b499d 100644 --- a/sv.c +++ b/sv.c @@ -9031,11 +9031,8 @@ Perl_ptr_table_new(pTHX) return tbl; } -#if (PTRSIZE == 8) -# define PTR_TABLE_HASH(ptr) (PTR2UV(ptr) >> 3) -#else -# define PTR_TABLE_HASH(ptr) (PTR2UV(ptr) >> 2) -#endif +#define PTR_TABLE_HASH(ptr) \ + ((PTR2UV(ptr) >> 3) ^ (PTR2UV(ptr) >> (3 + 7)) ^ (PTR2UV(ptr) >> (3 + 17))) /* we use the PTE_SVSLOT 'reservation' made above, both here (in the