mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
bignum.c: use predefined IDs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4dcad25b23
commit
5732225102
2 changed files with 8 additions and 6 deletions
13
bignum.c
13
bignum.c
|
|
@ -12,6 +12,7 @@
|
|||
#include "internal.h"
|
||||
#include "ruby/thread.h"
|
||||
#include "ruby/util.h"
|
||||
#include "id.h"
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
|
|
@ -5364,7 +5365,7 @@ rb_big_cmp(VALUE x, VALUE y)
|
|||
return rb_integer_float_cmp(x, y);
|
||||
}
|
||||
else {
|
||||
return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
|
||||
return rb_num_coerce_cmp(x, y, idCmp);
|
||||
}
|
||||
return INT2FIX(BIGNUM_SIGN(x) ? 1 : -1);
|
||||
}
|
||||
|
|
@ -5392,9 +5393,9 @@ big_op(VALUE x, VALUE y, enum big_op_t op)
|
|||
ID id = 0;
|
||||
switch (op) {
|
||||
case big_op_gt: id = '>'; break;
|
||||
case big_op_ge: id = rb_intern(">="); break;
|
||||
case big_op_ge: id = idGE; break;
|
||||
case big_op_lt: id = '<'; break;
|
||||
case big_op_le: id = rb_intern("<="); break;
|
||||
case big_op_le: id = idLE; break;
|
||||
}
|
||||
return rb_num_coerce_relop(x, y, id);
|
||||
}
|
||||
|
|
@ -6174,7 +6175,7 @@ rb_big_pow(VALUE x, VALUE y)
|
|||
if (RB_FLOAT_TYPE_P(y)) {
|
||||
d = RFLOAT_VALUE(y);
|
||||
if ((BIGNUM_NEGATIVE_P(x) && !BIGZEROP(x)) && d != round(d))
|
||||
return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
|
||||
return rb_funcall(rb_complex_raw1(x), idPow, 1, y);
|
||||
}
|
||||
else if (RB_BIGNUM_TYPE_P(y)) {
|
||||
y = bignorm(y);
|
||||
|
|
@ -6187,7 +6188,7 @@ rb_big_pow(VALUE x, VALUE y)
|
|||
yy = FIX2LONG(y);
|
||||
|
||||
if (yy < 0)
|
||||
return rb_funcall(rb_rational_raw1(x), rb_intern("**"), 1, y);
|
||||
return rb_funcall(rb_rational_raw1(x), idPow, 1, y);
|
||||
else {
|
||||
VALUE z = 0;
|
||||
SIGNED_VALUE mask;
|
||||
|
|
@ -6212,7 +6213,7 @@ rb_big_pow(VALUE x, VALUE y)
|
|||
}
|
||||
}
|
||||
else {
|
||||
return rb_num_coerce_bin(x, y, rb_intern("**"));
|
||||
return rb_num_coerce_bin(x, y, idPow);
|
||||
}
|
||||
return DBL2NUM(pow(rb_big2dbl(x), d));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1268,6 +1268,7 @@ bignum.$(OBJEXT): {$(VPATH)}bignum.c
|
|||
bignum.$(OBJEXT): {$(VPATH)}config.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}defines.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}encoding.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}id.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}intern.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}internal.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}io.h
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue