diff options
author | Kouhei Yanagita <yanagi@shakenbu.org> | 2023-08-29 14:49:57 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-29 18:00:44 +0900 |
commit | a28c5151f567cada0d2f5c0c3ec4df7f97b80784 (patch) | |
tree | c006d837ea1da1928f4d4d239c1262a045ae2e2e /array.c | |
parent | f16c50772c97c9cbc2f9f1eb0087224a92c3c99b (diff) |
Fix Array#bsearch when block returns a non-integer numeric value
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8314
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3522,8 +3522,8 @@ rb_ary_bsearch_index(VALUE ary) const VALUE zero = INT2FIX(0); switch (rb_cmpint(rb_funcallv(v, id_cmp, 1, &zero), v, zero)) { case 0: return INT2FIX(mid); - case 1: smaller = 1; break; - case -1: smaller = 0; + case 1: smaller = 0; break; + case -1: smaller = 1; } } else { |