The j format is still architecture depending, as the others already showed. If your perl has 64bit ints (even if the poiters are just 32bit), does q (or Q) work for you? (for portability, do not forget < or >). That won't work on 32-bit-only perl builds.
$ perl -MDP -we'DHexDump pack "Q", 0x12345678' 0000 78 56 34 12 00 00 00 00 xV4..... $ perl -MDP -we'DHexDump pack "Q>", 0x12345678' 0000 00 00 00 00 12 34 56 78 .....4Vx $ perl -MDP -we'DHexDump pack "Q<", 0x12345678' 0000 78 56 34 12 00 00 00 00 xV4..... $ perl -V:uvsize uvsize='8'; other perl $ perl -V:uvsize uvsize='4'; $ perl -wle'print length pack "Q", 3' Invalid type 'Q' in pack at -e line 1.
In reply to Re: reliably test integer size for portable bit-fiddling?
by Tux
in thread reliably test integer size for portable bit-fiddling?
by wollmers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |