summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-22 05:37:30 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-22 05:37:30 +0000
commit4b4ba84eb8e3b2a9efd1b2ea1ae6ee4869a9100c (patch)
treee499b9e29d3e4c29ccf2d8321b23a8ba56b80b52
parent1a2c400273620939d596fef3eacf95750cfdb039 (diff)
* ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of
rb_big2ulong_pack and rb_big2ull. * include/ruby/intern.h (rb_big2ulong_pack): Deprecated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--ext/dl/cfunc.c13
-rw-r--r--include/ruby/intern.h2
3 files changed, 16 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c72138012c..f422826da79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jun 22 14:35:40 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of
+ rb_big2ulong_pack and rb_big2ull.
+
+ * include/ruby/intern.h (rb_big2ulong_pack): Deprecated.
+
Sat Jun 22 14:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* ext/etc/etc.c (setup_passwd): pass 0 as VALUE to rb_struct_new to
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index 70be45624eb..076f71ae251 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -366,11 +366,14 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
stack[i] = (DLSTACK_TYPE)FIX2LONG(arg);
}
else if (RB_TYPE_P(arg, T_BIGNUM)) {
-#if SIZEOF_VOIDP == SIZEOF_LONG
- stack[i] = (DLSTACK_TYPE)rb_big2ulong_pack(arg);
-#else
- stack[i] = (DLSTACK_TYPE)rb_big2ull(arg);
-#endif
+ unsigned long ls[(sizeof(DLSTACK_TYPE) + sizeof(long) - 1)/sizeof(long)];
+ DLSTACK_TYPE d;
+ int j;
+ rb_big_pack(arg, ls, sizeof(ls)/sizeof(*ls));
+ d = 0;
+ for (j = 0; j < (int)(sizeof(ls)/sizeof(*ls)); j++)
+ d |= ls[j] << (j * sizeof(long) * CHAR_BIT);
+ stack[i] = d;
}
else {
Check_Type(arg, T_FIXNUM);
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 5c588929d1b..25199dce7c4 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -106,7 +106,7 @@ SIGNED_VALUE rb_big2long(VALUE);
#define rb_big2int(x) rb_big2long(x)
VALUE rb_big2ulong(VALUE);
#define rb_big2uint(x) rb_big2ulong(x)
-VALUE rb_big2ulong_pack(VALUE x);
+DEPRECATED(VALUE rb_big2ulong_pack(VALUE x));
#if HAVE_LONG_LONG
LONG_LONG rb_big2ll(VALUE);
unsigned LONG_LONG rb_big2ull(VALUE);