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

ruby-changes:15571

From: akr <ko1@a...>
Date: Sat, 24 Apr 2010 23:42:09 +0900 (JST)
Subject: [ruby-changes:15571] Ruby:r27477 (trunk): * lib/pp.rb: use [""].pack("p").size to detect the pointer size.

akr	2010-04-24 23:41:22 +0900 (Sat, 24 Apr 2010)

  New Revision: 27477

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

  Log:
    * lib/pp.rb: use [""].pack("p").size to detect the pointer size.

  Modified files:
    trunk/ChangeLog
    trunk/lib/pp.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27476)
+++ ChangeLog	(revision 27477)
@@ -1,3 +1,7 @@
+Sat Apr 24 23:40:50 2010  Tanaka Akira  <akr@f...>
+
+	* lib/pp.rb: use [""].pack("p").size to detect the pointer size.
+
 Sat Apr 24 21:07:27 2010  Tanaka Akira  <akr@f...>
 
 	* test/psych/test_psych.rb: don't leave temporary files.
Index: lib/pp.rb
===================================================================
--- lib/pp.rb	(revision 27476)
+++ lib/pp.rb	(revision 27477)
@@ -164,13 +164,7 @@
       group(1, '#<' + obj.class.name, '>', &block)
     end
 
-    if 0x100000000.class == Bignum
-      # 32bit
-      PointerMask = 0xffffffff
-    else
-      # 64bit
-      PointerMask = 0xffffffffffffffff
-    end
+    PointerMask = (1 << ([""].pack("p").size * 8)) - 1
 
     case Object.new.inspect
     when /\A\#<Object:0x([0-9a-f]+)>\z/

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

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