Skip to content

Commit

Permalink
doing loop(n) when n=0 does literally nothing, so zap
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 19, 2024
1 parent 25f3299 commit 5af0f72
Showing 1 changed file with 18 additions and 32 deletions.
50 changes: 18 additions & 32 deletions Basic/Primitive/primitive.pd
Original file line number Diff line number Diff line change
Expand Up @@ -2878,38 +2878,24 @@ for my $func ( [


my $code = undent q[
if ( $SIZE(n) == 0 ){
broadcastloop %{
loop(n) %{
$SETBAD(idx());
%}
%}
}
else {
broadcastloop %{
loop(n) %{
if ( $ISGOOD(vals()) ) {
PDL_Indx n1 = $SIZE(n)-1;
PDL_Indx low = %LOW%;
PDL_Indx high = %HIGH%;
PDL_Indx mid;
$GENERIC() value = $vals();
/* determine sort order of data */
int up = %UP%;
%CODE%
}
else {
$SETBAD(idx());
}
%}
%}
}
loop(n) %{
if ( $ISGOOD(vals()) ) {
PDL_Indx n1 = $SIZE(n)-1;
PDL_Indx low = %LOW%;
PDL_Indx high = %HIGH%;
PDL_Indx mid;
$GENERIC() value = $vals();
/* determine sort order of data */
int up = %UP%;
%CODE%
}
else {
$SETBAD(idx());
}
%}
----
];

Expand Down

0 comments on commit 5af0f72

Please sign in to comment.