Skip to content

Commit d863327

Browse files
mscdexMyles Borins
authored and
Myles Borins
committedJul 14, 2016
src: clean up string_search
This commit removes some unnecessary signed checks on unsigned variables. PR-URL: #7174 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 6562444 commit d863327

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/string_search.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Vector {
5353

5454
// Access individual vector elements - checks bounds in debug mode.
5555
T& operator[](size_t index) const {
56-
ASSERT(0 <= index && index < length_);
56+
ASSERT(index < length_);
5757
return start_[index];
5858
}
5959

@@ -416,7 +416,7 @@ size_t StringSearch<PatternChar, SubjectChar>::BoyerMooreSearch(
416416
return subject.length();
417417
}
418418
}
419-
while (j >= 0 && pattern[j] == (c = subject[index + j])) {
419+
while (pattern[j] == (c = subject[index + j])) {
420420
if (j == 0) {
421421
return index;
422422
}
@@ -544,7 +544,7 @@ size_t StringSearch<PatternChar, SubjectChar>::BoyerMooreHorspoolSearch(
544544
}
545545
}
546546
j--;
547-
while (j >= 0 && pattern[j] == (subject[index + j])) {
547+
while (pattern[j] == (subject[index + j])) {
548548
if (j == 0) {
549549
return index;
550550
}

0 commit comments

Comments
 (0)
Please sign in to comment.