Skip to content

Commit

Permalink
longlong fix for "Invalid type q in pack" (related to perl without 64…
Browse files Browse the repository at this point in the history
…bit int)
  • Loading branch information
kmx committed Aug 30, 2015
1 parent 7f0b8a9 commit d0e1cc9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Basic/Core/Core.pm
Expand Up @@ -11,6 +11,7 @@ our @ISA = qw( PDL::Exporter DynaLoader );
our $VERSION = '2.013';
bootstrap PDL::Core $VERSION;
use PDL::Types ':All';
use Config;

our @EXPORT = qw( piddle pdl null barf ); # Only stuff always exported!
my @convertfuncs = map PDL::Types::typefld($_,'convertfunc'), PDL::Types::typesrtkeys();
Expand Down Expand Up @@ -1256,6 +1257,12 @@ sub PDL::new {
# new was passed a string argument that doesn't look like a number
# so we can process as a Matlab-style data entry format.
return PDL::Core::new_pdl_from_string($new,$value,$this,$type);
} elsif ($Config{ivsize} < 8 && $pack[$new->get_datatype] eq 'q*') {
# special case when running on a perl without 64bit int support
# we have to avoid pack("q", ...) in this case
# because it dies with error: "Invalid type 'q' in pack"
$new->setdims([]);
set_c($new, [0], $value);
} else {
$new->setdims([]);
${$new->get_dataref} = pack( $pack[$new->get_datatype], $value );
Expand Down

0 comments on commit d0e1cc9

Please sign in to comment.