diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-19 04:32:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-19 04:32:52 +0000 |
commit | 6839d47eb88a839155db263b6d262b1e5a6a2406 (patch) | |
tree | 02969d192245bbaa2c5650ee0a0b31312d728e49 /include | |
parent | 5f03f753eefcff619b8792c52a4a6735bd626282 (diff) | |
download | ruby-6839d47eb88a839155db263b6d262b1e5a6a2406.tar.gz |
ruby.h: rb_big_sign
* include/ruby/ruby.h (RBIGNUM_SIGN): use a wrapper function to
return the sign bit, instead of comparing with 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/ruby.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index eeae2f6879..72e91c2f7b 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1185,9 +1185,10 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *); #define RSTRUCT_SET(st, idx, v) rb_struct_aset(st, INT2NUM(idx), (v)) #define RSTRUCT_GET(st, idx) rb_struct_aref(st, INT2NUM(idx)) -#define RBIGNUM_SIGN(b) (RB_FIX2LONG(rb_big_cmp((b), RB_INT2FIX(0))) >= 0) -#define RBIGNUM_POSITIVE_P(b) (RB_FIX2LONG(rb_big_cmp((b), RB_INT2FIX(0))) >= 0) -#define RBIGNUM_NEGATIVE_P(b) (RB_FIX2LONG(rb_big_cmp((b), RB_INT2FIX(0))) < 0) +int rb_big_sign(VALUE); +#define RBIGNUM_SIGN(b) (rb_big_sign(b)) +#define RBIGNUM_POSITIVE_P(b) (RBIGNUM_SIGN(b)!=0) +#define RBIGNUM_NEGATIVE_P(b) (RBIGNUM_SIGN(b)==0) #define R_CAST(st) (struct st*) #define RBASIC(obj) (R_CAST(RBasic)(obj)) |