* include/ruby/ruby.h (RBIGNUM_SIGN): use FIX2LONG() instead of
  FIX2INT() for optimization, since rb_big_cmp() returns only
  Fixnum -1..+1 for Finxum 0.

  (RBIGNUM_POSITIVE_P, RBIGNUM_NEGATIVE_P): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-02-16 07:20:23 +00:00
Родитель 3efb36c25c
Коммит 71430123d3
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -1069,9 +1069,9 @@ struct RStruct {
#define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
#define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
#define RBIGNUM_SIGN(b) (FIX2INT(rb_big_cmp((b), INT2FIX(0))) >= 0)
#define RBIGNUM_POSITIVE_P(b) (FIX2INT(rb_big_cmp((b), INT2FIX(0))) >= 0)
#define RBIGNUM_NEGATIVE_P(b) (FIX2INT(rb_big_cmp((b), INT2FIX(0))) < 0)
#define RBIGNUM_SIGN(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0)
#define RBIGNUM_POSITIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0)
#define RBIGNUM_NEGATIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) < 0)
#define R_CAST(st) (struct st*)
#define RBASIC(obj) (R_CAST(RBasic)(obj))