Skip to content

Commit

Permalink
fix packsize for indx to base on ptrsize, not ivsize
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jan 6, 2025
1 parent 8f29e5a commit c926b56
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- fix Math::polyroots with native-complex input and supplied null output
- add Pars type-spec "!real" which makes it an error to supply real values (#511)
- now an error to call Ops::carg on a real value, or Ops::czip on complex inputs (#511)
- fix packsize for indx to base on ptrsize, not ivsize (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1092246) - thanks Helge Deller for report

2.098 2025-01-03
- fix Windows build problems
Expand Down
15 changes: 4 additions & 11 deletions lib/PDL/Types.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ my @TYPE_VERBATIM = (@TYPE_CHECK, qw(
my @TYPE_MODIFIED = qw(realversion complexversion isnan isfinite);

sub packtypeof_PDL_Indx {
if ($Config{'ivsize'} == 8) {
return 'q*';
}
elsif ($Config{'ivsize'} == 4 ) {
return 'l*';
}
else {
die "Types.pm.PL: packtype for ivsize==$Config{'ivsize'} not handled\n";
}
return 'q*' if $Config{ptrsize} == 8;
return 'l*' if $Config{ptrsize} == 4;
die "PDL::Types: packtype for ptrsize==$Config{ptrsize} not handled\n";
}

# Data types *must* be listed in order of complexity!!
Expand Down Expand Up @@ -593,8 +587,7 @@ __END__
You can change the types that PDL knows about by editing entries in
the definition of the variable C<@types> that appears close to the
top of the file F<Types.pm.PL> (i.e. the file from which this module
was generated).
top of the file F<lib/PDL/Types.pm>.
=head2 Format of a type entry
Expand Down
3 changes: 3 additions & 0 deletions t/pdl_from_string.t
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ is pdl(ushort, ['-5'])."", "[65531]", "ushort-typed ['-5'] converted right";
is pdl(ushort, '[-5]')."", "[65531]", "ushort-typed '[-5]' converted right";
is pdl(ushort, [-5])."", "[65531]", "ushort-typed [-5] converted right";

# capture indx() on big-endian - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1092246
is pdl(indx, 2)."", "2", "indx-typed 2 packed/upd_data-ed right";

done_testing;

# Basic 2D array
Expand Down

0 comments on commit c926b56

Please sign in to comment.