Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: courgette/third_party/bsdiff/qsufsort.h

Issue 2078743002: [Courgette] Make BSDiff search() use lexicographical_compare(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: courgette/third_party/bsdiff/qsufsort.h
diff --git a/courgette/third_party/bsdiff/qsufsort.h b/courgette/third_party/bsdiff/qsufsort.h
index ba90efc8524858a57a66edcc57c9ab44ee866a29..323c1d1404271ebf686b948ae6f9ded1bb84b6de 100644
--- a/courgette/third_party/bsdiff/qsufsort.h
+++ b/courgette/third_party/bsdiff/qsufsort.h
@@ -48,9 +48,6 @@
#ifndef COURGETTE_THIRD_PARTY_BSDIFF_QSUFSORT_H_
#define COURGETTE_THIRD_PARTY_BSDIFF_QSUFSORT_H_
-#include <algorithm>
-#include <cstring>
-
namespace courgette {
namespace qsuf {
@@ -220,50 +217,10 @@ static void qsufsort(T I, T V, const unsigned char* old, int oldsize) {
I[V[i]] = i;
}
-static int matchlen(const unsigned char* old,
- int oldsize,
- const unsigned char* newbuf,
- int newsize) {
- int i;
-
- for (i = 0; (i < oldsize) && (i < newsize); i++)
- if (old[i] != newbuf[i])
- break;
-
- return i;
-}
-
-template <class T>
-static int search(T I,
- const unsigned char* old,
- int oldsize,
- const unsigned char* newbuf,
- int newsize,
- int* pos) {
- int lo = 0;
- int hi = oldsize;
- while (hi - lo >= 2) {
- int mid = (lo + hi) / 2;
- if (memcmp(old + I[mid], newbuf, std::min(oldsize - I[mid], newsize)) < 0) {
- lo = mid;
- } else {
- hi = mid;
- }
- }
-
- int x = matchlen(old + I[lo], oldsize - I[lo], newbuf, newsize);
- int y = matchlen(old + I[hi], oldsize - I[hi], newbuf, newsize);
- if (x > y) {
- *pos = I[lo];
- return x;
- }
- *pos = I[hi];
- return y;
-}
-
// End of 'verbatim' code.
// ------------------------------------------------------------------------
} // namespace qsuf
} // namespace courgette
+
#endif // COURGETTE_THIRD_PARTY_BSDIFF_QSUFSORT_H_
« no previous file with comments | « courgette/third_party/bsdiff/bsdiff_search_unittest.cc ('k') | courgette/third_party/bsdiff/qsufsort_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698