diff --git a/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json b/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json
index 1857949..867b8ab 100644
--- a/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json
+++ b/External/Reloaded.Memory.SigScan.ReloadedII/ModConfig.json
@@ -2,7 +2,7 @@
"ModId": "Reloaded.Memory.SigScan.ReloadedII",
"ModName": "Library: Reloaded.Memory.Sigscan for Reloaded II",
"ModAuthor": "Sewer56",
- "ModVersion": "1.2.11",
+ "ModVersion": "1.2.13",
"ModDescription": "Shared implementation of Reloaded.Memory.Sigscan",
"ModDll": "Reloaded.Memory.SigScan.ReloadedII.dll",
"ModIcon": "Preview.png",
diff --git a/Reloaded.Memory.Sigscan/Reloaded.Memory.Sigscan.csproj b/Reloaded.Memory.Sigscan/Reloaded.Memory.Sigscan.csproj
index 56c2330..7eaf710 100644
--- a/Reloaded.Memory.Sigscan/Reloaded.Memory.Sigscan.csproj
+++ b/Reloaded.Memory.Sigscan/Reloaded.Memory.Sigscan.csproj
@@ -21,7 +21,7 @@
preview
true
- 3.1.6
+ 3.1.8
diff --git a/Reloaded.Memory.Sigscan/Scanner_AVX2.cs b/Reloaded.Memory.Sigscan/Scanner_AVX2.cs
index 9a21045..0e5181e 100644
--- a/Reloaded.Memory.Sigscan/Scanner_AVX2.cs
+++ b/Reloaded.Memory.Sigscan/Scanner_AVX2.cs
@@ -55,7 +55,7 @@ public static PatternScanResult FindPatternAvx2(byte* data, int dataLength, stri
int matchTableLength = matchTable.Length;
var firstByteVec = Vector256.Create(patternData.Bytes[patternData.LeadingIgnoreCount]);
- int searchLength = dataLength - Math.Max(patternData.Bytes.Length >> 5 << 5, AvxRegisterLength); // bitshift rounds down
+ int searchLength = dataLength - (patternData.Bytes.Length + AvxRegisterLength);
int leadingIgnoreCount = patternData.LeadingIgnoreCount;
ref var pVec = ref patternVectors[0];
@@ -68,6 +68,11 @@ public static PatternScanResult FindPatternAvx2(byte* data, int dataLength, stri
var dataMaxPtr = dataPtr + searchLength;
for (; dataPtr < dataMaxPtr; dataPtr++)
{
+ if (dataPtr > (void*)0x00000001778b1000)
+ {
+ var a = 5;
+ }
+
// Problem: If pattern starts with unknown, will never match.
var rhs = Avx.LoadVector256(dataPtr);
var equal = Avx2.CompareEqual(pFirstByteVec, rhs);
diff --git a/Reloaded.Memory.Sigscan/Scanner_SSE2.cs b/Reloaded.Memory.Sigscan/Scanner_SSE2.cs
index 0d89509..8331973 100644
--- a/Reloaded.Memory.Sigscan/Scanner_SSE2.cs
+++ b/Reloaded.Memory.Sigscan/Scanner_SSE2.cs
@@ -54,7 +54,7 @@ public static PatternScanResult FindPatternSse2(byte* data, int dataLength, stri
int matchTableLength = matchTable.Length;
var firstByteVec = Vector128.Create(patternData.Bytes[patternData.LeadingIgnoreCount]);
- int searchLength = dataLength - Math.Max(patternData.Bytes.Length >> 4 << 4, SseRegisterLength); // bitshift rounds down
+ int searchLength = dataLength - (patternData.Bytes.Length + SseRegisterLength);
int leadingIgnoreCount = patternData.LeadingIgnoreCount;
ref var pVec = ref patternVectors[0];