1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Made hashing better

This commit is contained in:
Brian Fiete 2020-05-15 12:39:07 -07:00
parent 63c6421413
commit f3e9224a45

View file

@ -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