+
+ int lroot;
+ if (is_commutative)
+ lroot = root;
+ else
+ lroot = 0;
+ relrank = (rank - lroot + comm_size) % comm_size;
+
+ smpi_datatype_extent(datatype, &true_lb, &true_extent);
+
+ /* adjust for potential negative lower bound in datatype */
+ tmp_buf = (void *)((char*)tmp_buf - true_lb);
+
+ /* If I'm not the root, then my recvbuf may not be valid, therefore
+ I have to allocate a temporary one */
+ if (rank != root) {
+ recvbuf = (void *) smpi_get_tmp_recvbuffer(count*(max(extent,true_extent)));
+ recvbuf = (void *)((char*)recvbuf - true_lb);
+ }
+ if ((rank != root) || (sendbuf != MPI_IN_PLACE)) {
+ smpi_datatype_copy(sendbuf, count, datatype, recvbuf,count, datatype);
+ }