Skip to content

Commit

Permalink
get_convertedpdl to pass "flowing" flag to output
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Dec 2, 2024
1 parent 50801ff commit 89b7d1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Basic/lib/PDL/Core/pdlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,16 @@ pdl *pdl_scalar(PDL_Anyval anyval) {
}

pdl *pdl_get_convertedpdl(pdl *old,int type) {
PDLDEBUG_f(printf("pdl_get_convertedpdl\n"));
if(old->datatype == type) return old;
pdl *it = pdl_pdlnew();
if (!it) return it;
pdl_error PDL_err = pdl_converttypei_new(old,it,type);
if (PDL_err.error) { pdl_destroy(it); return NULL; }
return it;
PDLDEBUG_f(printf("pdl_get_convertedpdl\n"));
if(old->datatype == type) return old;
char was_flowing = (old->state & PDL_DATAFLOW_F);
pdl *it = pdl_pdlnew();
if (!it) return it;
pdl_error PDL_err = pdl_converttypei_new(old,it,type);
if (PDL_err.error) { pdl_destroy(it); return NULL; }
if (was_flowing)
it->state |= PDL_DATAFLOW_F;
return it;
}

pdl_error pdl_allocdata(pdl *it) {
Expand Down
2 changes: 2 additions & 0 deletions Basic/t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,8 @@ my $oneway_slice = $y->slice('0:1');
is "$oneway_slice", '[4 5]';
eval {$oneway_slice .= 11};
isnt $@, '', 'error on assigning into one-way slice';
my $c = $y->flowing->_convert_int(cdouble->enum);
ok $c->fflows, 'flowing -> converted has "flowing" on';
}

my $notouch = sequence(4);
Expand Down

0 comments on commit 89b7d1a

Please sign in to comment.