Simple way to detect 32bit vs 64bit?

Anyone have simple means for checking if the running arch is 32bit or 64bit?

ruby-1.9.2-p0 > RUBY_PLATFORM
=> "x86_64-darwin10.4.0"

···

On Fri, Jan 28, 2011 at 3:31 PM, Intransition <transfire@gmail.com> wrote:

Anyone have simple means for checking if the running arch is 32bit or
64bit?

1.size => 4 on 32 bit, 8 on 64 bit.

-Justin

···

On 01/28/2011 12:31 PM, Intransition wrote:

Anyone have simple means for checking if the running arch is 32bit or 64bit?

As Park Heesob pointed out to me, that's not reliable. Use this
instead:

['a'].pack('P').length > 4 ? "64Bit" : "32Bit"

Regards,

Dan

···

On Jan 28, 3:15 pm, Justin Collins <justincoll...@ucla.edu> wrote:

On 01/28/2011 12:31 PM, Intransition wrote:> Anyone have simple means for checking if the running arch is 32bit or
> 64bit?

1.size => 4 on 32 bit, 8 on 64 bit.

Awesome, thanks.