- if (0 == root) {
- /* root on 0, just use the send buffer */
- ptmp = (char *) sbuf;
- if (rbuf != MPI_IN_PLACE) {
- /* local copy to rbuf */
- err = Datatype::copy(sbuf, scount, sdtype,
- rbuf, rcount, rdtype);
- if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
- }
- } else {
- /* root is not on 0, allocate temp buffer for send */
- tempbuf = (char *) smpi_get_tmp_sendbuffer(strue_extent + (scount*size - 1) * sextent);
- if (NULL == tempbuf) {
- err = MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
- }
-
- ptmp = tempbuf - slb;
-
- /* and rotate data so they will eventually in the right place */
- err = Datatype::copy((char *) sbuf + sextent*root*scount, scount*(size-root), sdtype,
- ptmp, scount*(size-root), sdtype);
- if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
-
-
- err = Datatype::copy((char*)sbuf, scount*root, sdtype,
- ptmp + sextent*scount*(size - root), scount*root, sdtype);
- if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
-
- if (rbuf != MPI_IN_PLACE) {
- /* local copy to rbuf */
- err = Datatype::copy(ptmp, scount, sdtype,
- rbuf, rcount, rdtype);
- if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
- }
- }
- total_send = scount;
- } else if (!(vrank % 2)) {
- /* non-root, non-leaf nodes, allocate temp buffer for recv
- * the most we need is rcount*size/2 */
- tempbuf = (char *) smpi_get_tmp_recvbuffer(rtrue_extent + (rcount*size - 1) * rextent);
- if (NULL == tempbuf) {
- err= MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
- }
-
- ptmp = tempbuf - rlb;
-
- sdtype = rdtype;
- scount = rcount;
- sextent = rextent;
- total_send = scount;
+ if (0 == root) {
+ /* root on 0, just use the send buffer */
+ ptmp = (char*)sbuf;
+ if (rbuf != MPI_IN_PLACE) {
+ /* local copy to rbuf */
+ err = Datatype::copy(sbuf, scount, sdtype, rbuf, rcount, rdtype);
+ if (MPI_SUCCESS != err) {
+ line = __LINE__;
+ goto err_hndl;
+ }
+ }
+ } else {
+ /* root is not on 0, allocate temp buffer for send */
+ tempbuf = (char*)smpi_get_tmp_sendbuffer(strue_extent + (scount * size - 1) * sextent);
+ if (NULL == tempbuf) {
+ err = MPI_ERR_OTHER;
+ line = __LINE__;
+ goto err_hndl;
+ }
+
+ ptmp = tempbuf - slb;
+
+ /* and rotate data so they will eventually in the right place */
+ err = Datatype::copy((char*)sbuf + sextent * root * scount, scount * (size - root), sdtype, ptmp,
+ scount * (size - root), sdtype);
+ if (MPI_SUCCESS != err) {
+ line = __LINE__;
+ goto err_hndl;
+ }
+
+ err = Datatype::copy((char*)sbuf, scount * root, sdtype, ptmp + sextent * scount * (size - root), scount * root,
+ sdtype);
+ if (MPI_SUCCESS != err) {
+ line = __LINE__;
+ goto err_hndl;
+ }
+
+ if (rbuf != MPI_IN_PLACE) {
+ /* local copy to rbuf */
+ err = Datatype::copy(ptmp, scount, sdtype, rbuf, rcount, rdtype);
+ if (MPI_SUCCESS != err) {
+ line = __LINE__;
+ goto err_hndl;
+ }
+ }
+ }
+ total_send = scount;
+ } else if (not(vrank % 2)) {
+ /* non-root, non-leaf nodes, allocate temp buffer for recv
+ * the most we need is rcount*size/2 */
+ tempbuf = (char*)smpi_get_tmp_recvbuffer(rtrue_extent + (rcount * size - 1) * rextent);
+ if (NULL == tempbuf) {
+ err = MPI_ERR_OTHER;
+ line = __LINE__;
+ goto err_hndl;
+ }
+
+ ptmp = tempbuf - rlb;
+
+ sdtype = rdtype;
+ scount = rcount;
+ sextent = rextent;
+ total_send = scount;