From: Luis Lavena Date: 2007-12-28T23:55:04+09:00 Subject: Re: testing for 64-bit environment On Dec 28, 2:05 am, justincoll...@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 > > R...@AgileConsultingLLC.com > > irb(main):001:0> RUBY_PLATFORM > => "x86_64-linux" > irb(main):002:0> 1.size > => 8 > Please note that RUBY_PLATFORM indicates on which platform ruby was built, but not the current host platform. On Windows x64, I can build 32 bits or 64 bits application and run them side by side. One-Click installer reports me i386-mswin32 even that I'm on x64 HOST OS. Luis