Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: How to tell 32 or 64 bit

by salva (Abbot)
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)'


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.

Replies are listed 'Best First'.
Re^2: How to tell 32 or 64 bit
by Tux (Abbot) on Oct 08, 2012 at 09:23 UTC


    $ 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 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 bulk88 (Priest) on Oct 08, 2012 at 15:09 UTC
    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997755]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-05-26 22:05 GMT
Find Nodes?
    Voting Booth?