Re: [boost] Re: [review results] hash functions accepted

In-Reply-To: <d1na66$6p2$1@sea.gmane.org> daniel@calamity.org.uk (Daniel James) wrote (abridged):
5. change implementation of hash values for pointers so undefined behavior is gone (and consider adding x + (x >> 3) )
I'm going to do that.
Is it worth considering using x + x / sizeof(*p) instead? -- Dave Harris, Nottingham, UK

Dave Harris wrote:
In-Reply-To: <d1na66$6p2$1@sea.gmane.org> daniel@calamity.org.uk (Daniel James) wrote (abridged):
5. change implementation of hash values for pointers so undefined behavior is gone (and consider adding x + (x >> 3) )
I'm going to do that.
Is it worth considering using x + x / sizeof(*p) instead?
This will not work for incomplete types, including void. I'd prefer equal hash_values for an incomplete T*, complete T*, and void* with the same value. We'll lose one potential bit of enthropy when alignof(x) == 16, but this seems sufficiently rare in practice.
participants (2)
-
brangdon@cix.compulink.co.uk
-
Peter Dimov