64bit perl

You might think your perl is ‘compiled 64bit’, but is it really planning on using 64bit integer scalars?

integer bits:
perl -MConfig -e 'print $Config{ivsize}*8'

largest integer:
perl -e 'print ~0'

largest signed integer:
perl -MConfig -e 'print( (1<<$Config{ivsize}*8-1)-1 )'

smallest signed integer:
perl -MConfig -e 'print -(1<<$Config{ivsize}*8-1)'

Comments

    Leave a comment