summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-04 14:41:55 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-04 14:41:55 +0000
commitddb3fbc63d7d34e43a5e53f1ddb9cafb4e3a7c0b (patch)
tree1ee5c1229f0d37c9af26d2f4178edf209e720aa1 /enum.c
parentb0f62ba6d168099e47bdda5ac3c75684099ed528 (diff)
* enum.c (nmin_filter): Fix limit value.
patch by Helder Pereira. [Bug #11471] [ruby-core:70477] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/enum.c b/enum.c
index ea101ba..df62afa 100644
--- a/enum.c
+++ b/enum.c
@@ -1192,6 +1192,7 @@ nmin_filter(struct nmin_data *data)
long numelts;
long left, right;
+ long store_index;
long i, j;
@@ -1217,7 +1218,6 @@ nmin_filter(struct nmin_data *data)
while (1) {
long pivot_index = left + (right-left)/2;
- long store_index;
long num_pivots = 1;
SWAP(pivot_index, right);
@@ -1261,9 +1261,9 @@ nmin_filter(struct nmin_data *data)
#undef GETPTR
#undef SWAP
+ data->limit = RARRAY_PTR(data->buf)[store_index*eltsize];
data->curlen = data->n;
rb_ary_resize(data->buf, data->n * eltsize);
- data->limit = RARRAY_PTR(data->buf)[(data->n-1)*eltsize];
}
static VALUE
@@ -1283,7 +1283,7 @@ nmin_i(VALUE i, VALUE *_data, int argc, VALUE *argv)
int c = data->cmpfunc(&cmpv, &data->limit, data);
if (data->rev)
c = -c;
- if (c > 0)
+ if (c >= 0)
return Qnil;
}