mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Use OPTIMIZED_CMP in r_less instead of <=>
This commit is contained in:
parent
2230ac4a28
commit
c750afd80c
1 changed files with 4 additions and 5 deletions
9
range.c
9
range.c
|
@ -199,11 +199,10 @@ range_eq(VALUE range, VALUE obj)
|
|||
static int
|
||||
r_less(VALUE a, VALUE b)
|
||||
{
|
||||
VALUE r = rb_funcall(a, id_cmp, 1, b);
|
||||
|
||||
if (NIL_P(r))
|
||||
return INT_MAX;
|
||||
return rb_cmpint(r, a, b);
|
||||
VALUE r;
|
||||
#define rb_cmpint(cmp, a, b) (NIL_P(r = (cmp)) ? INT_MAX : rb_cmpint(r, (a), (b)))
|
||||
return OPTIMIZED_CMP(a, b);
|
||||
#undef rb_cmpint
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue