From 118c1a70c7e8f9733d406cf69de9a5970b3ceb01 Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Wed, 30 Jan 2013 21:23:13 +0000 Subject: [PATCH] SkNextLog2 requires positive values. git-svn-id: http://skia.googlecode.com/svn/trunk@7474 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkTSort.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/SkTSort.h b/src/core/SkTSort.h index 0eeb068..fbdb55b 100644 --- a/src/core/SkTSort.h +++ b/src/core/SkTSort.h @@ -191,8 +191,11 @@ template 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 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); } -- 2.7.4