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

Side by Side Diff: courgette/third_party/bsdiff/bsdiff_search.h

Issue 1948843002: [Courgette Experimental] Replace QSufSort with libdivsufsort Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and merge. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2003, 2004 Colin Percival 1 // Copyright 2003, 2004 Colin Percival
2 // All rights reserved 2 // All rights reserved
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted providing that the following conditions 5 // modification, are permitted providing that the following conditions
6 // are met: 6 // are met:
7 // 1. Redistributions of source code must retain the above copyright 7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright 9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the 10 // notice, this list of conditions and the following disclaimer in the
(...skipping 29 matching lines...) Expand all
40 // Copyright 2016 The Chromium Authors. All rights reserved. 40 // Copyright 2016 The Chromium Authors. All rights reserved.
41 // Use of this source code is governed by a BSD-style license that can be 41 // Use of this source code is governed by a BSD-style license that can be
42 // found in the LICENSE file. 42 // found in the LICENSE file.
43 43
44 #ifndef COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_SEARCH_H_ 44 #ifndef COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_SEARCH_H_
45 #define COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_SEARCH_H_ 45 #define COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_SEARCH_H_
46 46
47 #include <algorithm> 47 #include <algorithm>
48 #include <cstring> 48 #include <cstring>
49 49
50 namespace courgette { 50 namespace bsdiff {
51 51
52 // Similar to ::memcmp(), but returns match length instead. 52 // Similar to ::memcmp(), but returns match length instead.
53 inline int matchlen(const unsigned char* old, 53 inline int matchlen(const unsigned char* old,
54 int oldsize, 54 int oldsize,
55 const unsigned char* newbuf, 55 const unsigned char* newbuf,
56 int newsize) { 56 int newsize) {
57 int i; 57 int i;
58 58
59 for (i = 0; (i < oldsize) && (i < newsize); i++) 59 for (i = 0; (i < oldsize) && (i < newsize); i++)
60 if (old[i] != newbuf[i]) 60 if (old[i] != newbuf[i])
(...skipping 28 matching lines...) Expand all
89 int x = matchlen(old + I[lo], oldsize - I[lo], newbuf, newsize); 89 int x = matchlen(old + I[lo], oldsize - I[lo], newbuf, newsize);
90 int y = matchlen(old + I[hi], oldsize - I[hi], newbuf, newsize); 90 int y = matchlen(old + I[hi], oldsize - I[hi], newbuf, newsize);
91 if (x > y) { 91 if (x > y) {
92 *pos = I[lo]; 92 *pos = I[lo];
93 return x; 93 return x;
94 } 94 }
95 *pos = I[hi]; 95 *pos = I[hi];
96 return y; 96 return y;
97 } 97 }
98 98
99 } // namespace courgette 99 } // namespace bsdiff
100 100
101 #endif // COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_SEARCH_H_ 101 #endif // COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_SEARCH_H_
OLDNEW
« no previous file with comments | « courgette/third_party/bsdiff/bsdiff_create.cc ('k') | courgette/third_party/bsdiff/bsdiff_search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698