diff --git a/include/mdsdescrip.h b/include/mdsdescrip.h index 9344dc010c..64df6c381c 100644 --- a/include/mdsdescrip.h +++ b/include/mdsdescrip.h @@ -163,7 +163,8 @@ typedef struct descriptor_a * * The multipliers block has the following format: * char *a0; Address of the element whose subscripts are - * all zero int m [DIMCT]; Addressing coefficients (multipliers) + * all zero + * int m [DIMCT]; Addressing coefficients (multipliers) * * The bounds block has the following format: * struct diff --git a/tdishr/TdiTrans.c b/tdishr/TdiTrans.c index 76307dfbba..4f303f08a8 100644 --- a/tdishr/TdiTrans.c +++ b/tdishr/TdiTrans.c @@ -116,6 +116,13 @@ int Tdi1Trans(int opcode, int narg, mdsdsc_t *list[], mdsdsc_xd_t *out_ptr) const mdsdsc_t *pmask = &one; mds_signal_t *psig; signal_maxdim tmpsig; + aflags_t aflags_default = { + .binscale = 0, + .redim = 1, + .column = 1, + .coeff = 0, + .bounds = 0, + }; array_bounds arr, *pa, *pd; mdsdsc_xd_t sig[3] = {EMPTY_XD}, uni[3] = {EMPTY_XD}, dat[3] = {EMPTY_XD}; struct TdiCatStruct cats[4]; @@ -293,13 +300,16 @@ int Tdi1Trans(int opcode, int narg, mdsdsc_t *list[], mdsdsc_xd_t *out_ptr) /** scalar to simple vector **/ if (rank == 0) { memcpy((char *)&arr, (char *)pa, sizeof(struct descriptor)); + arr.scale = 0; + arr.digits = 0; + arr.aflags = aflags_default; arr.dimct = 1; - arr.aflags.coeff = 0; - arr.a0 = arr.pointer; arr.arsize = arr.length; - arr.m[0] = 1; - arr.m[1] = 1; - arr.m[dim] = ncopies; + /* unused fields */ + arr.a0 = arr.pointer; + arr.m[0] = ncopies; /* coeff */ + arr.m[0 + 1] = 0; /* lower bound */ + arr.m[0 + 2] = ncopies-1; /* upper bound */ } /** simple and coefficient vector **/ else @@ -337,13 +347,16 @@ int Tdi1Trans(int opcode, int narg, mdsdsc_t *list[], mdsdsc_xd_t *out_ptr) /** scalar to simple vector **/ if (rank == 0) { memcpy((char *)&arr, (char *)pa, sizeof(struct descriptor)); + arr.scale = 0; + arr.digits = 0; + arr.aflags = aflags_default; arr.dimct = 1; - arr.aflags.coeff = 0; - arr.a0 = arr.pointer; arr.arsize = arr.length; - arr.m[0] = 1; - arr.m[1] = 1; - arr.m[dim] = ncopies; + /* unused fields */ + arr.a0 = arr.pointer; + arr.m[0] = ncopies; /* coeff */ + arr.m[0 + 1] = 0; /* lower bound */ + arr.m[0 + 2] = ncopies-1; /* upper bound */ } else if (rank >= MAX_DIMS) status = TdiNDIM_OVER; diff --git a/tditest/testing/test-tdishr.ans b/tditest/testing/test-tdishr.ans index 80abe6ea71..5ef3aea907 100644 --- a/tditest/testing/test-tdishr.ans +++ b/tditest/testing/test-tdishr.ans @@ -5674,8 +5674,12 @@ lastloc(_M) Byte_Unsigned([[0,0,0,0], [0,0,0,0], [0,0,0,1], [0,0,0,0]]) lastloc(_M,0) Byte_Unsigned([[0,0,1,0], [0,0,1,0], [0,0,0,1], [0,0,0,0]]) +replicate(2,0,3) +[2,2,2] replicate([[2,4],[3,5]],1,3) [[2,4], [3,5], [2,4], [3,5], [2,4], [3,5]] +spread(2,0,3) +[2,2,2] spread([2,3,4],0,3) [[2,2,2], [3,3,3], [4,4,4]] trim(' A B ') diff --git a/tditest/testing/test-tdishr.tdi b/tditest/testing/test-tdishr.tdi index 7ebc26b560..fb223487c2 100644 --- a/tditest/testing/test-tdishr.tdi +++ b/tditest/testing/test-tdishr.tdi @@ -2986,7 +2986,9 @@ firstloc(_M) firstloc(_M,0) lastloc(_M) lastloc(_M,0) +replicate(2,0,3) replicate([[2,4],[3,5]],1,3) +spread(2,0,3) spread([2,3,4],0,3) # # Functions implemented in TdiTrim.c