From 5af0f729c43daf49473d09caade80e809f21a916 Mon Sep 17 00:00:00 2001 From: Ed J Date: Mon, 19 Feb 2024 20:56:21 +0000 Subject: [PATCH] doing loop(n) when n=0 does literally nothing, so zap --- Basic/Primitive/primitive.pd | 50 +++++++++++++----------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/Basic/Primitive/primitive.pd b/Basic/Primitive/primitive.pd index 37691a42c..ff316c7b2 100644 --- a/Basic/Primitive/primitive.pd +++ b/Basic/Primitive/primitive.pd @@ -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()); + } + %} ---- ];