[geos-devel] Re: [GEOS] #202: Undefined behavior in
Coordinate::hashCode
GEOS
geos-trac at osgeo.org
Fri Aug 29 16:08:11 EDT 2008
#202: Undefined behavior in Coordinate::hashCode
------------------------------------+---------------------------------------
Reporter: mloskot | Owner: geos-devel at lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone:
Component: Core | Version: svn-trunk
Severity: Significant | Resolution:
Keywords: coordinate hash double |
------------------------------------+---------------------------------------
Comment (by bmharper):
Mateusz - you mentioned that this violates aliasing rules:
unsigned int HashDouble( double d )
{
unsigned int* i = (unsigned int*) &d;
return i[0] ^ i[1];
}
Can you explain further, or point me to the relevant C/++ docs?
Thanks,
Ben
ps-- Your code references &x. Should this not be &d?
--
Ticket URL: <http://trac.osgeo.org/geos/ticket/202#comment:1>
GEOS <http://geos.refractions.net/>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
More information about the geos-devel
mailing list