[LLVMdev] ADT/Hashing.h on 32-bit platforms

Chandler Carruth chandlerc at google.com
Sat Feb 1 15:48:46 PST 2014


On Sat, Feb 1, 2014 at 8:35 AM, Stephan Tolksdorf <st at quanttec.com> wrote:

> Hi,
>
> Currently the hashing implementation in ADT/Hashing.h produces hash values
> on 32-bit platforms that differ from the lower 32-bits of the hash values
> produced on 64-bit platforms. It seems the only reason for this difference
> is that the uint64_t integer seed is truncated to size_t. Since the usage
> of uint64_t and size_t as types for seed values in the implementation is
> somewhat inconsistent, I'm wondering: Was this difference deliberately
> introduced as a performance optimization for 32-bit code, or is this maybe
> just an implementation artifact?
>
> I also noted that the implementation relies on implicit conversions from
> uint64_t to size_t in several places where hash_code values are returned,
> which may trigger compiler warnings on 32-bit platforms.


Almost all of this was largely incidental on my part. I didn't spend a lot
of time tuning the 32-bit platform performance. If you have ideas that you
think would make things better, I'm certainly interested. =D

One thing I would note is that I would prefer to retain the collision
resistance where possible. So I would be leery of reducing the internal
state used. I would more focus on making the outputs friendly for 32-bit
platforms and the inputs consistent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140201/91aa27bf/attachment.html>


More information about the llvm-dev mailing list