Simplify comparision in binary search

This commit is contained in:
Alexander Kojevnikov 2010-05-21 09:08:12 +10:00
parent a4f35a625c
commit f162976486

View File

@ -233,8 +233,7 @@ namespace Spek {
while (k - i > 1) {
var j = (i + k) / 2;
cr.text_extents (end ? s[0:j] + fix : fix + s[j:s.length], out ext);
// TODO: replace with XOR when bgo#619177 is fixed.
if (end && ext.width <= length || !end && ext.width > length) {
if (end != (ext.width > length)) {
i = j;
} else {
k = j;