forked from MoonsideGames/MoonTools.Bonk
move MakeLong to SpatialHash
parent
0ad7d34a18
commit
22d99e6b8d
|
@ -42,7 +42,7 @@ namespace MoonTools.Core.Bonk
|
|||
{
|
||||
for (var j = minHash.Item2; j <= maxHash.Item2; j++)
|
||||
{
|
||||
var key = LongHelper.MakeLong(i, j);
|
||||
var key = MakeLong(i, j);
|
||||
if (!hashDictionary.ContainsKey(key))
|
||||
{
|
||||
hashDictionary.Add(key, new HashSet<T>());
|
||||
|
@ -67,7 +67,7 @@ namespace MoonTools.Core.Bonk
|
|||
{
|
||||
for (int j = minHash.Item2; j <= maxHash.Item2; j++)
|
||||
{
|
||||
var key = LongHelper.MakeLong(i, j);
|
||||
var key = MakeLong(i, j);
|
||||
if (hashDictionary.ContainsKey(key))
|
||||
{
|
||||
foreach (var t in hashDictionary[key])
|
||||
|
@ -92,5 +92,10 @@ namespace MoonTools.Core.Bonk
|
|||
|
||||
IDLookup.Clear();
|
||||
}
|
||||
|
||||
private static long MakeLong(int left, int right)
|
||||
{
|
||||
return ((long)left << 32) | ((uint)right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
namespace MoonTools.Core.Bonk
|
||||
{
|
||||
public static class LongHelper
|
||||
{
|
||||
public static long MakeLong(int left, int right)
|
||||
{
|
||||
return ((long)left << 32) | ((uint)right);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue