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

Side by Side Diff: xfa/fgas/crt/fgas_algorithm.h

Issue 2007443003: Replace CFX_DSPATemplate with std::binary_search. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « xfa/fde/css/fde_cssdatatable.cpp ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_FGAS_CRT_FGAS_ALGORITHM_H_
8 #define XFA_FGAS_CRT_FGAS_ALGORITHM_H_
9
10 #include <cstdint>
11
12 #include "core/fxcrt/include/fx_basic.h"
13
14 template <class baseType>
15 class CFX_DSPATemplate {
16 public:
17 int32_t Lookup(const baseType& find, const baseType* pArray, int32_t iCount) {
18 ASSERT(pArray);
19 if (iCount < 1)
20 return -1;
21
22 int32_t iStart = 0, iEnd = iCount - 1, iMid;
23 do {
24 iMid = (iStart + iEnd) / 2;
25 const baseType& v = pArray[iMid];
26 if (find == v)
27 return iMid;
28 if (find < v)
29 iEnd = iMid - 1;
30 else
31 iStart = iMid + 1;
32 } while (iStart <= iEnd);
33 return -1;
34 }
35 };
36
37 #endif // XFA_FGAS_CRT_FGAS_ALGORITHM_H_
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssdatatable.cpp ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698