Skip to content

Commit

Permalink
Update src/libutil/references.cc
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Hensing <[email protected]>
  • Loading branch information
Ericson2314 and roberth authored Jun 23, 2023
1 parent 8bdd5ff commit b28f126
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libutil/references.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ static void search(
isBase32[(unsigned char) base32Chars[i]] = true;
});

/* Nested loops, but the inner loop also advances i, so
this is an asymptotically optimal solution for finding
hash-like substrings. */
for (size_t i = 0; i + refLength <= s.size(); ) {
/* Check whether the next `refLength` bytes are a possible
reference (because they are all base-32 characters). */
Expand Down

0 comments on commit b28f126

Please sign in to comment.