move MakeLong to SpatialHash

generics
Evan Hemsley 2019-12-31 17:57:38 -08:00
parent 0ad7d34a18
commit 22d99e6b8d
2 changed files with 7 additions and 12 deletions

View File

@ -42,7 +42,7 @@ namespace MoonTools.Core.Bonk
{ {
for (var j = minHash.Item2; j <= maxHash.Item2; j++) for (var j = minHash.Item2; j <= maxHash.Item2; j++)
{ {
var key = LongHelper.MakeLong(i, j); var key = MakeLong(i, j);
if (!hashDictionary.ContainsKey(key)) if (!hashDictionary.ContainsKey(key))
{ {
hashDictionary.Add(key, new HashSet<T>()); hashDictionary.Add(key, new HashSet<T>());
@ -67,7 +67,7 @@ namespace MoonTools.Core.Bonk
{ {
for (int j = minHash.Item2; j <= maxHash.Item2; j++) for (int j = minHash.Item2; j <= maxHash.Item2; j++)
{ {
var key = LongHelper.MakeLong(i, j); var key = MakeLong(i, j);
if (hashDictionary.ContainsKey(key)) if (hashDictionary.ContainsKey(key))
{ {
foreach (var t in hashDictionary[key]) foreach (var t in hashDictionary[key])
@ -92,5 +92,10 @@ namespace MoonTools.Core.Bonk
IDLookup.Clear(); IDLookup.Clear();
} }
private static long MakeLong(int left, int right)
{
return ((long)left << 32) | ((uint)right);
}
} }
} }

View File

@ -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);
}
}
}