From: Tom Metge Date: 2007-12-28T15:35:30+09:00 Subject: Re: testing for 64-bit environment Much more elegant (not to mention cross platform). Exactly what I was looking for- thanks. Tom On Dec 27, 2007, at 10:05 PM, justincollins@ucla.edu wrote: > Quoting Rob Biedenharn : > >> >> On Dec 27, 2007, at 10:59 PM, Tom Metge wrote: >> >>> in case anyone else is wondering, my solution: >>> >>> arch = `uname -i` >>> >>> tom >>> >>> On Dec 27, 2007, at 8:15 PM, Tom Metge wrote: >>> >>>> subject says it all- anyone know a way to determine if the host >>>> system is 64-bit? i need to load a different module for >>>> different environments. >>>> >>>> thanks, >>>> tom >> >> >> I only have a 32-bit system to try, but the Pickaxe seems to indicate >> that Fixnum.size is the bytes in the machine representation of a >> Fixnum. >> >> On my Intel MacBookPro: >> >> irb> Object::PLATFORM >> => "universal-darwin9.0" >> irb> 1.size >> => 4 >> irb> (2**30 - 1).class >> => Fixnum >> irb> (2**30 - 1).size >> => 4 >> irb> (2**31 - 1).class >> => Bignum >> irb> (2**31 - 1).size >> => 4 >> irb> (2**32 - 1).size >> => 4 >> irb> (2**33 - 1).size >> => 8 >> irb> (2**33 - 1).class >> => Bignum >> >> Note that Fixnum can hold 31 bits (30 + sign bit) and Bignum jumps >> from >> 4 bytes to 8 bytes. >> >> What do you get for 1.size on a 64-bit platform? >> >> -Rob >> >> Rob Biedenharn http://agileconsultingllc.com >> Rob@AgileConsultingLLC.com > > irb(main):001:0> RUBY_PLATFORM > => "x86_64-linux" > irb(main):002:0> 1.size > => 8 > > > -Justin > >