From f3e9224a45143205438d47e8f48e6c86430665ce Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 15 May 2020 12:39:07 -0700 Subject: [PATCH] Made hashing better --- BeefLibs/corlib/src/Double.bf | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/BeefLibs/corlib/src/Double.bf b/BeefLibs/corlib/src/Double.bf index 9bbbe707..8bd3df41 100644 --- a/BeefLibs/corlib/src/Double.bf +++ b/BeefLibs/corlib/src/Double.bf @@ -41,17 +41,8 @@ namespace System // Ensure that 0 and -0 have the same hash code return 0; } - - if (sizeof(int) == sizeof(double)) - { - var val = (double)this; - return *(int*)(&val); - } - else - { - int64 value = *(int64*)(&d); - return ((int32)value) ^ ((int32)(value >> 32)); - } + return *((int*)&d) ^ ((int32*)&d)[1]; + } public bool IsInfinity