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

Stephan Tolksdorf st at quanttec.com
Sat Feb 1 08:35:56 PST 2014


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.

- Stephan




More information about the llvm-dev mailing list