[Mesa-dev] [PATCH] util: Change the pointer hashing function

Eric Anholt eric at anholt.net
Thu May 18 22:29:28 UTC 2017


Thomas Helland <thomashelland90 at gmail.com> writes:

> Use our knowledge that pointers are at least 4 byte aligned to remove
> the useless digits. Then shift by 6, 10, and 14 bits and add this to
> the original pointer, effectively folding in the entropy of the higher
> bits of the pointer into a 4-bit section. Stopping at 14 means we can
> add the entropy from 18 bits, or at least a 600Kbyte section of memory.
> Assuming that ralloc allocates from a linearly allocated heap less than
> this we can make a very efficient pointer hashing function for our usecase.

The fnv1 on the pointer was basically a stand-in until someone did the
kind of analysis you've done here.  Thanks!

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170518/5bff8df6/attachment.sig>


More information about the mesa-dev mailing list