[前][次][番号順一覧][スレッド一覧]

ruby-changes:29509

From: akr <ko1@a...>
Date: Sat, 22 Jun 2013 14:37:40 +0900 (JST)
Subject: [ruby-changes:29509] akr:r41561 (trunk): * ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of

akr	2013-06-22 14:37:30 +0900 (Sat, 22 Jun 2013)

  New Revision: 41561

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41561

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/dl/cfunc.c
    trunk/include/ruby/intern.h

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 41560)
+++ include/ruby/intern.h	(revision 41561)
@@ -106,7 +106,7 @@ SIGNED_VALUE rb_big2long(VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L106
 #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);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41560)
+++ ChangeLog	(revision 41561)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jun 22 14:35:40 2013  Tanaka Akira  <akr@f...>
+
+	* 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@r...>
 
 	* ext/etc/etc.c (setup_passwd): pass 0 as VALUE to rb_struct_new to
Index: ext/dl/cfunc.c
===================================================================
--- ext/dl/cfunc.c	(revision 41560)
+++ ext/dl/cfunc.c	(revision 41561)
@@ -366,11 +366,14 @@ rb_dlcfunc_call(VALUE self, VALUE ary) https://github.com/ruby/ruby/blob/trunk/ext/dl/cfunc.c#L366
 	    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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]