in reply to Re^2: Supporting 64-bit ints on 32-bit perl
in thread Supporting 64-bit ints on 32-bit perl

but it is a non-core XS module that doesn't really provide much advantage over Math::BigInt

Well, Math::Int64 does provide better performance than Math::BigInt.
But if you're looking for something that's already part of perl's core, then I can't think of anything other than Math::BigInt.

I take it you're aware that most 32-bit perls (especially the modern ones) have 64-bit IV/UVs and already support pack's "Q" template.
In any case, you'll also find 32-bit builds whose IV/UVs are only 32-bits ... and I understand these are the builds that you're wanting to cater to.
You distinguish between the 2 different configurations by checking to see whether $Config{ivsize} is 4 or 8. (Sorry ... you probably already know all about that.)

Cheers,
Rob
  • Comment on Re^3: Supporting 64-bit ints on 32-bit perl

Replies are listed 'Best First'.
Re^4: Supporting 64-bit ints on 32-bit perl
by NERDVANA (Priest) on Apr 20, 2023 at 01:26 UTC

    Yeah, actually the biggest driver for this is cpan testers :-) My error message is "Author is lazy and requires 64-bit perl integers". But there's no way I know to exclude the 32-bit perls, and then I get those pesky failures on my testers matrix. And then I was thinking "Maybe I could try not being lazy and actually make it work on 32-bit perls?"

    This is in fact the same reason I fixed ELF::Writer to support 32-bit perls and perls before 5.10, but yes I know I could just declare a minimum perl version and not need to see errors on 5.8 related to pack('Q<'). But I already implemented the workaround for pack('Q<'), so seems a shame to not keep using it.

      But there's no way I know to exclude the 32-bit perls

      You would just want your CPU-x86_64-InstructionWriter-0.002 Makefile.PL to begin with:
      use strict; use warnings; use 5.010000; use ExtUtils::MakeMaker; if($Config::Config{ivsize} != 8) { warn "This module requires 64-bit integers"; exit 0; } # existing code then follows, unaltered.
      I don't know how you achieve that alteration using Dist::Zilla to generate your Makefile.PL, but cpantesters would then report your module as "NA" instead of "FAIL".
      Anyway, adding support for 32-bit integers might be a more interesting exercise ;-)

      Cheers,
      Rob