summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/ext/integer_spec.c
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/optional/capi/ext/integer_spec.c')
-rw-r--r--spec/ruby/optional/capi/ext/integer_spec.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/optional/capi/ext/integer_spec.c b/spec/ruby/optional/capi/ext/integer_spec.c
index 821d8373c9..792fc0652a 100644
--- a/spec/ruby/optional/capi/ext/integer_spec.c
+++ b/spec/ruby/optional/capi/ext/integer_spec.c
@@ -5,21 +5,21 @@
extern "C" {
#endif
-#ifdef HAVE_RB_INTEGER_PACK
static VALUE integer_spec_rb_integer_pack(VALUE self, VALUE value,
- VALUE words, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags)
-{
+ VALUE words, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags) {
int result = rb_integer_pack(value, (void*)RSTRING_PTR(words), FIX2INT(numwords),
FIX2INT(wordsize), FIX2INT(nails), FIX2INT(flags));
return INT2FIX(result);
}
-#endif
-void Init_integer_spec(void) {
-#ifdef HAVE_RB_INTEGER_PACK
- VALUE cls;
- cls = rb_define_class("CApiIntegerSpecs", rb_cObject);
+RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y); /* internal.h, used in ripper */
+
+static VALUE integer_spec_rb_int_positive_pow(VALUE self, VALUE a, VALUE b) {
+ return rb_int_positive_pow(FIX2INT(a), FIX2INT(b));
+}
+void Init_integer_spec(void) {
+ VALUE cls = rb_define_class("CApiIntegerSpecs", rb_cObject);
rb_define_const(cls, "MSWORD", INT2NUM(INTEGER_PACK_MSWORD_FIRST));
rb_define_const(cls, "LSWORD", INT2NUM(INTEGER_PACK_LSWORD_FIRST));
rb_define_const(cls, "MSBYTE", INT2NUM(INTEGER_PACK_MSBYTE_FIRST));
@@ -32,9 +32,9 @@ void Init_integer_spec(void) {
rb_define_const(cls, "NEGATIVE", INT2NUM(INTEGER_PACK_NEGATIVE));
rb_define_method(cls, "rb_integer_pack", integer_spec_rb_integer_pack, 6);
-#endif
+ rb_define_method(cls, "rb_int_positive_pow", integer_spec_rb_int_positive_pow, 2);
}
#ifdef __cplusplus
-extern "C" {
+}
#endif