Skip to content

Commit

Permalink
only loop over inds once
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 21, 2024
1 parent 1a17098 commit 31e49a7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Basic/Core/pdlbroadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,17 @@ pdl_error pdl_dim_checks(
continue;
}
PDL_Indx *dims = pdl->dims;
if ((load_only || (creating && !creating[i])) && ninds > PDLMAX(0,ndims)) {
/* Dimensional promotion when number of dims is less than required: */
for (j=0; j<ninds; j++) {
ind_id = PDL_IND_ID(vtable, i, j);
if (ndims < j+1 && ind_sizes[ind_id] <= 1) ind_sizes[ind_id] = 1;
}
}
/* Now, the real check. */
for (j=0; j<ninds; j++) {
PDL_Indx ind_id = PDL_IND_ID(vtable, i, j), ind_sz = ind_sizes[ind_id];
if (
(load_only || (creating && !creating[i])) &&
ninds > PDLMAX(0,ndims) &&
ndims < j+1 &&
ind_sz < 1
)
/* Dimensional promotion when number of dims is less than required: */
ind_sz = ind_sizes[ind_id] = 1;
/* Now, the real check. */
if (
!(load_only && !((vtable->par_flags[i] & PDL_PARAM_ISCREAT) && (pdl->state & PDL_MYDIMS_TRANS))) &&
(!creating || creating[i])
Expand Down

0 comments on commit 31e49a7

Please sign in to comment.