Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ByteBuffer#index for read-write boundary match
The previous implementation searched the buffers individually, which will only work correctly for search substrings of length 1. This instead implements the continued search by folding the write buffer into the read buffer unless a match was found in the initial segment. An alternative that doesn't fold the two buffers could naturally be implemented, but that would be much more complicated. In principle, the old implementation could be retained for one character substrings, but I did not think it would be a common enough case to be worth the extra effort.
- Loading branch information
Showing
2 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters