in reply to Re: reliably test integer size for portable bit-fiddling?
in thread reliably test integer size for portable bit-fiddling?

Thx, but if I can avoid loading Config, and the dependency on it, then pure Perl wins.

root@raspberry2:/home/helmut# time perl -MConfig -E 'print $Config{ivs +ize};' 8 real 0m0.177s user 0m0.160s sys 0m0.010s root@raspberry2:/home/helmut# time perl -e 'print length(pack('j', -1 +))*8;' 64 real 0m0.028s user 0m0.020s sys 0m0.000s

Replies are listed 'Best First'.
Re^3: reliably test integer size for portable bit-fiddling?
by RonW (Parson) on Dec 08, 2014 at 21:09 UTC
    Config is a core module, so is always available.
Re^3: reliably test integer size for portable bit-fiddling?
by BrowserUk (Patriarch) on Dec 08, 2014 at 20:50 UTC

    Your code seems to work fine here:

    C:\test>\perl32\bin\perl -e"print length(pack('j', -1))*8;" 32 C:\test>perl -e"print length(pack('j', -1))*8;" 64

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: reliably test integer size for portable bit-fiddling?
by ikegami (Patriarch) on Dec 10, 2014 at 07:07 UTC
    Config is part of Perl, and is Pure Perl.