How to check if Perl installation is set to 32 or 64 bit?

On Windows, how can I check if the Perl installation is set to 32 or 64 bit?

+7
source share
5 answers

I am reading the question whether Perl needs to be compiled 64 bit, not Windows or CPU.

Perl can be configured to use a 64-bit degree of varying degrees. You can watch this with the Config module.

To check if Perl is compiled to use 64-bit integers, you can look at the use64bitint entry in Config.

 use Config; print $Config{use64bitint}; 

define indicates yes.

There is also ...

  • use64bitall The perl value will be compiled to use the entire 64-bit version, including 64-bit pointers, allowing access to more than two gigabytes of memory.
  • ivsize , indicating how many bytes Perl will use to store an integer, 8 indicates 64 bits.
  • ptrsize - how many bits Perl will use to store pointers, which allows you to use more than 2 gigabytes of memory for each process, 8 - 64 bits.

Common Config variables and their values ​​can be seen in perl -V (note capital V). Their definitions can be found using perldoc Config .

Note. You can compile Perl to use 64-bit integers regardless of whether your operating system or processor is 32 or 64 bit. On a 32-bit processor, Perl will use a type other than integer to store numbers, possibly a long integer.

+17
source

If you want to check if it uses 32-bit or 64-bit integers, use the following:

 perl -V:ivsize # use Config; say $Config{ivsize} 
  • If the return value is 4, your Perl uses 32-bit integers.
  • If the return value is 8, your Perl uses 64-bit integers.

See also: Answer to the question "What is the Perl equivalent of MAX_INT?"


If you want to check if it uses 32-bit or 64-bit pointers, use the following:

 perl -V:ptrsize # use Config; say $Config{ptrsize} 
  • If the return value is 4, your Perl can address 4 GB of RAM.
  • If the return value is 8, your Perl can access "unlimited" RAM.

If you want to check if it is a 32-bit or 64-bit program, use the following:

 perl -V:archname # use Config; say $Config{archname} 
  • If the return value includes x86_64 , this is a 64-bit process.
  • If the return value includes x86 (but not x86_64 ), this is a 32-bit process.

This value is also included in the output of perl -v .


Note. use64bitint or use64bitall should not be checked because they indicate which parameters were passed to Configure and do not provide information about what was actually used.

+16
source

Just check the version / build:

 perl -v 

And I got:

 This is perl, v5.8.8 built for msys-64int Copyright 1987-2006, Larry Wall ... 
+2
source

log(~0 +1)/log(2) works because:

  • ~ 0 "bitwise not zero" β†’ UINT_MAX
  • UINT_MAX is either 2 ^ 32-1 or 2 ^ 64-1, depending on the architecture (or compilation options)
  • log (2 ^ 32) / log (2) = 32 and log (2 ^ 64) / log (2) = 64, by design.

So basically this is perl command order to say how many bits UINT_MAX has.

$ perl -e "print log(~0 +1)/log(2)" 32 $ perl -V:archname archname='MSWin32-x86-multi-thread';

+2
source

Just use

 log(~0 +1)/log(2) 

....

-3
source

Source: https://habr.com/ru/post/1203899/


All Articles