File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,30 @@ rb_rational_den(VALUE rat)
127
127
}
128
128
#endif
129
129
130
+ #ifndef HAVE_RB_COMPLEX_REAL
131
+ static inline VALUE
132
+ rb_complex_real (VALUE cmp )
133
+ {
134
+ #ifdef HAVE_TYPE_STRUCT_RCOMPLEX
135
+ return RCOMPLEX (cmp )-> real ;
136
+ #else
137
+ return rb_funcall (cmp , rb_intern ("real" ), 0 );
138
+ #endif
139
+ }
140
+ #endif
141
+
142
+ #ifndef HAVE_RB_COMPLEX_IMAG
143
+ static inline VALUE
144
+ rb_complex_imag (VALUE cmp )
145
+ {
146
+ #ifdef HAVE_TYPE_STRUCT_RCOMPLEX
147
+ return RCOMPLEX (cmp )-> imag ;
148
+ #else
149
+ return rb_funcall (cmp , rb_intern ("imag" ), 0 );
150
+ #endif
151
+ }
152
+ #endif
153
+
130
154
#define BIGDECIMAL_POSITIVE_P (bd ) ((bd)->sign > 0)
131
155
#define BIGDECIMAL_NEGATIVE_P (bd ) ((bd)->sign < 0)
132
156
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ def check_bigdecimal_version(gemspec_path)
36
36
have_type ( "struct RRational" , "ruby.h" )
37
37
have_func ( "rb_rational_num" , "ruby.h" )
38
38
have_func ( "rb_rational_den" , "ruby.h" )
39
+ have_type ( "struct RComplex" , "ruby.h" )
40
+ have_func ( "rb_complex_real" , "ruby.h" )
41
+ have_func ( "rb_complex_imag" , "ruby.h" )
39
42
have_func ( "rb_array_const_ptr" , "ruby.h" )
40
43
have_func ( "rb_sym2str" , "ruby.h" )
41
44
have_func ( "rb_opts_exception_p" , "ruby.h" )
You can’t perform that action at this time.
0 commit comments