[geos-devel] Ticket #202 (double hash)
Mateusz Loskot
mateusz at loskot.net
Fri Aug 29 06:32:49 EDT 2008
Ben Harper wrote:
> Apologies for sending this to the entire list, but I couldn't figure
> out how to comment on the ticket alone. I created an OSGeo user
> account, and logged in to trac, but still no GUI available.
Ben,
This is strange. Perhaps you could report this problem to SAC
mailing list: http://lists.osgeo.org/mailman/listinfo/sac
> Anyway, concerning an I32 hash on a double, I think the easiest naive
> solution that does not have terrible performance concerns is:
>
> unsigned int HashDouble( double d )
> {
> unsigned int* i = (unsigned int*) &d;
This construction breaks strict aliasing rules,
so it's undefined behavior.
> return i[0] ^ i[1];
> }
Yes, this is popular hack, however AFAIK it doesn't promise no
duplication will occur.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
More information about the geos-devel
mailing list