This commit is contained in:
DCFApixels 2024-11-19 12:00:09 +08:00
parent cdfa1de017
commit b728206d8b

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Data.SqlTypes;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using TValue = System.Int32; using TValue = System.Int32;
@ -354,6 +355,10 @@ namespace DCFApixels.DragonECS.Graphs.Internal
{ {
unchecked unchecked
{ {
const decimal G1 = 1.6180339887498948482045868383m;
const uint Q32_MAX = uint.MaxValue;
const uint X1_Q32 = (uint)(1m / G1 * Q32_MAX) + 1;
//count = GetHighBitNumber((uint)count) << 1; //count = GetHighBitNumber((uint)count) << 1;
if (count <= length) { return; } if (count <= length) { return; }
@ -369,9 +374,11 @@ namespace DCFApixels.DragonECS.Graphs.Internal
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
state ^= state << 13; //state ^= state << 13;
state ^= state >> 17; //state ^= state >> 17;
state ^= state << 5; //state ^= state << 5;
state = X1_Q32 * state;
//int v = Mixing(i); //int v = Mixing(i);
hashes[i] = (int)state; hashes[i] = (int)state;