diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-24 14:41:22 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-24 14:41:22 +0000 |
commit | 9ac224eb2699d528f7c3544861f02a5255605f4f (patch) | |
tree | 19af6b3183a6ee5f7ef2d619eb20d0f4ef8803f7 | |
parent | 0e5546df901d15381d4ec08af11971c649a7c308 (diff) |
* lib/pp.rb: use [""].pack("p").size to detect the pointer size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/pp.rb | 8 |
2 files changed, 5 insertions, 7 deletions
@@ -1,3 +1,7 @@ +Sat Apr 24 23:40:50 2010 Tanaka Akira <akr@fsij.org> + + * lib/pp.rb: use [""].pack("p").size to detect the pointer size. + Sat Apr 24 21:07:27 2010 Tanaka Akira <akr@fsij.org> * test/psych/test_psych.rb: don't leave temporary files. @@ -164,13 +164,7 @@ class PP < PrettyPrint 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/ |