Boyer-Moore-Horspool Algorithm for All Matches (Find Byte array inside Byte array)
问题 Here is my implementation of BMH algorithm (it works like a charm): public static Int64 IndexOf(this Byte[] value, Byte[] pattern) { if (value == null) throw new ArgumentNullException("value"); if (pattern == null) throw new ArgumentNullException("pattern"); Int64 valueLength = value.LongLength; Int64 patternLength = pattern.LongLength; if ((valueLength == 0) || (patternLength == 0) || (patternLength > valueLength)) return -1; Int64[] badCharacters = new Int64[256]; for (Int64 i = 0; i < 256;