How can I check whether my Perl installation is 32 or 64 bit?

前端 未结 5 2046
旧巷少年郎
旧巷少年郎 2020-12-06 02:07

On Windows, how can I check whether my Perl installation is 32 or 64 bit?

5条回答
  •  广开言路
    2020-12-06 02:58

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

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

    So basically this command order perl to say how many bits have its UINT_MAX.

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

提交回复
热议问题