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

Side by Side Diff: src/gpu/GrTBSearch.h

Issue 150943002: Split GrUnitTests.cpp into two separate unit tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « gyp/tests.gyp ('k') | tests/GrBinHashKeyTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9
10
11 #ifndef GrTBSearch_DEFINED 8 #ifndef GrTBSearch_DEFINED
12 #define GrTBSearch_DEFINED 9 #define GrTBSearch_DEFINED
13 10
11 #include "SkTypes.h"
12
14 template <typename ELEM, typename KEY> 13 template <typename ELEM, typename KEY>
15 int GrTBSearch(const ELEM array[], int count, KEY target) { 14 int GrTBSearch(const ELEM array[], int count, KEY target) {
16 SkASSERT(count >= 0); 15 SkASSERT(count >= 0);
17 if (0 == count) { 16 if (0 == count) {
18 // we should insert it at 0 17 // we should insert it at 0
19 return ~0; 18 return ~0;
20 } 19 }
21 20
22 int high = count - 1; 21 int high = count - 1;
23 int low = 0; 22 int low = 0;
(...skipping 12 matching lines...) Expand all
36 } 35 }
37 36
38 // now return the ~ of where we should insert it 37 // now return the ~ of where we should insert it
39 if (LT(array[high], target)) { 38 if (LT(array[high], target)) {
40 high += 1; 39 high += 1;
41 } 40 }
42 return ~high; 41 return ~high;
43 } 42 }
44 43
45 #endif 44 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gyp ('k') | tests/GrBinHashKeyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698