From 4b4ba84eb8e3b2a9efd1b2ea1ae6ee4869a9100c Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 22 Jun 2013 05:37:30 +0000 Subject: * 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 --- ext/dl/cfunc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'ext/dl') diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index 70be45624e..076f71ae25 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); -- cgit v1.2.3