зеркало из https://github.com/github/ruby.git
[ruby/bigdecimal] Remove checks for `struct RRational` and `struct RComplex`
These are used to see only if `RRATIONAL` and `RCOMPLEX` are available, however, these two are macros and can be checked with `#ifdef` directly. https://github.com/ruby/bigdecimal/commit/175bbacd43
This commit is contained in:
Родитель
8b64e8f2ed
Коммит
673759328c
|
@ -67,10 +67,8 @@ have_header("ruby/atomic.h")
|
|||
have_header("ruby/internal/has/builtin.h")
|
||||
have_header("ruby/internal/static_assert.h")
|
||||
|
||||
have_type("struct RRational", "ruby.h")
|
||||
have_func("rb_rational_num", "ruby.h")
|
||||
have_func("rb_rational_den", "ruby.h")
|
||||
have_type("struct RComplex", "ruby.h")
|
||||
have_func("rb_complex_real", "ruby.h")
|
||||
have_func("rb_complex_imag", "ruby.h")
|
||||
have_func("rb_array_const_ptr", "ruby.h")
|
||||
|
|
|
@ -126,7 +126,7 @@ char *BigDecimal_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, c
|
|||
static inline VALUE
|
||||
rb_rational_num(VALUE rat)
|
||||
{
|
||||
#ifdef HAVE_TYPE_STRUCT_RRATIONAL
|
||||
#ifdef RRATIONAL
|
||||
return RRATIONAL(rat)->num;
|
||||
#else
|
||||
return rb_funcall(rat, rb_intern("numerator"), 0);
|
||||
|
@ -138,7 +138,7 @@ rb_rational_num(VALUE rat)
|
|||
static inline VALUE
|
||||
rb_rational_den(VALUE rat)
|
||||
{
|
||||
#ifdef HAVE_TYPE_STRUCT_RRATIONAL
|
||||
#ifdef RRATIONAL
|
||||
return RRATIONAL(rat)->den;
|
||||
#else
|
||||
return rb_funcall(rat, rb_intern("denominator"), 0);
|
||||
|
@ -152,7 +152,7 @@ rb_rational_den(VALUE rat)
|
|||
static inline VALUE
|
||||
rb_complex_real(VALUE cmp)
|
||||
{
|
||||
#ifdef HAVE_TYPE_STRUCT_RCOMPLEX
|
||||
#ifdef RCOMPLEX
|
||||
return RCOMPLEX(cmp)->real;
|
||||
#else
|
||||
return rb_funcall(cmp, rb_intern("real"), 0);
|
||||
|
@ -164,7 +164,7 @@ rb_complex_real(VALUE cmp)
|
|||
static inline VALUE
|
||||
rb_complex_imag(VALUE cmp)
|
||||
{
|
||||
# ifdef HAVE_TYPE_STRUCT_RCOMPLEX
|
||||
# ifdef RCOMPLEX
|
||||
return RCOMPLEX(cmp)->imag;
|
||||
# else
|
||||
return rb_funcall(cmp, rb_intern("imag"), 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче