mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
3efb36c25c
commit
71430123d3
1 changed files with 3 additions and 3 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue