| ... | ... | @@ -876,6 +876,8 @@ fn boyerMooreHorspoolPreprocessReverse(pattern: []const u8, table: *[256]usize) |
| 876 | 876 | } |
| 877 | 877 | |
| 878 | 878 | var i: usize = pattern.len - 1; |
| 879 | // The first item is intentionally ignored and the skip size will be pattern.len. |
| 880 | // This is the standard way boyer-moore-horspool is implemented. |
| 879 | 881 | while (i > 0) : (i -= 1) { |
| 880 | 882 | table[pattern[i]] = i; |
| 881 | 883 | } |
| ... | ... | @@ -887,6 +889,8 @@ fn boyerMooreHorspoolPreprocess(pattern: []const u8, table: *[256]usize) void { |
| 887 | 889 | } |
| 888 | 890 | |
| 889 | 891 | var i: usize = 0; |
| 892 | // The last item is intentionally ignored and the skip size will be pattern.len. |
| 893 | // This is the standard way boyer-moore-horspool is implemented. |
| 890 | 894 | while (i < pattern.len - 1) : (i += 1) { |
| 891 | 895 | table[pattern[i]] = pattern.len - 1 - i; |
| 892 | 896 | } |