Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
We don't bite newbies here... much
 
PerlMonks  

Re: How to tell 32 or 64 bit

by salva (Monsignor)
on Oct 08, 2012 at 07:18 UTC ( #997755=note: print w/ replies, xml ) Need Help??


in reply to How to tell 32 or 64 bit

perl -E 'say log(~0)/log(2)'

update:

Note that this command shows the number of bits on an IV, the type used internally by Perl to handle integers. Usually, it has the same number of bits as the CPU architecture but it is also possible to compile Perl for a 32 bits architecture while having 64 bits IVs. For instance, Debian does it.


Comment on Re: How to tell 32 or 64 bit
Download Code
Re^2: How to tell 32 or 64 bit
by Anonymous Monk on Oct 08, 2012 at 08:44 UTC
    $ perl -E 'say log(~0)/log(2)' 31.9999999996641

    Oh, damn. My bit is getting worn out.

Re^2: How to tell 32 or 64 bit
by Tux (Monsignor) on Oct 08, 2012 at 09:23 UTC

    UNTRUE!:

    $ perl -wE'say log(~0)/log(2)' 64 $ perl -v This is perl 5, version 16, subversion 0 (v5.16.0) built for i686-linu +x-64int-ld $ ux Linux 3.4.6-2.10-desktop [openSUSE 12.2 (Mantis)] i386 Core(TM) i7-26 +20M CPU @ 2.70GHz/800(4) i686

    On 32bit systems I build my perl with -Duse64bitint and -Duselongdouble, so your statement will not work at all!


    Enjoy, Have FUN! H.Merijn
Re^2: How to tell 32 or 64 bit
by bulk88 (Priest) on Oct 08, 2012 at 15:09 UTC
    length(pack('J',0))
    in the past I used that, but then I realized that 64 bit IVs but 32 bit pointers and machine code Perls existed, so it is wrong. Another good way to telling is
    perl -MConfig -e "print $Config{ptrsize}"
    which will return 4 or 8, and is NOT the IV size

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2014-04-18 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (471 votes), past polls