[Mono-bugs] [Bug 58792][Wis] Changed - GetHashCode for Single, Double and Decimal aren't optimal
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 21 May 2004 14:52:59 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=58792
--- shadow/58792 2004-05-21 10:43:29.000000000 -0400
+++ shadow/58792.tmp.2351 2004-05-21 14:52:59.000000000 -0400
@@ -28,6 +28,12 @@
Where m_value is either a float or double. So 1.0, 1.1, 1.11 ... all get
the same hash code.
------- Additional Comments From sebastien@ximian.com 2004-05-21 10:42 -------
Decimal isn't great either with "return (int)lo32;"
+
+------- Additional Comments From bmaurer@users.sf.net 2004-05-21 14:52 -------
+A logical thing to do would be to take the value of the bits. I think
+you can do this with unsafe code. IIRC, you can do
+
+return (*((long*)&this.m_value)).GetHashCode ();