aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-30 21:23:13 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-30 21:23:13 +0000
commit118c1a70c7e8f9733d406cf69de9a5970b3ceb01 (patch)
treec74bd8325bf7bf57e7fee6387a84f3ab2a1a5995
parenta265a1e35d150033c504e3aef71c70b733cafa92 (diff)
SkNextLog2 requires positive values.
git-svn-id: http://skia.googlecode.com/svn/trunk@7474 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/core/SkTSort.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/SkTSort.h b/src/core/SkTSort.h
index 0eeb0681be..fbdb55ba8c 100644
--- a/src/core/SkTSort.h
+++ b/src/core/SkTSort.h
@@ -191,8 +191,11 @@ template <typename T, typename C> void SkTIntroSort(int depth, T* left, T* right
* @param lessThan a functor with bool operator()(T a, T b) which returns true if a comes before b.
*/
template <typename T, typename C> void SkTQSort(T* left, T* right, C lessThan) {
+ if (left >= right) {
+ return;
+ }
ptrdiff_t size = right - left;
- int depth = SkNextLog2(SkToU32(size + 1));
+ int depth = SkNextLog2(SkToU32(size));
SkTIntroSort(depth * 2, left, right, lessThan);
}