зеркало из https://github.com/github/ruby.git
ruby.h: use FIX2LONG
* 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:
Родитель
3efb36c25c
Коммит
71430123d3
|
@ -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))
|
||||
|
|
Загрузка…
Ссылка в новой задаче