4{
9
10 Int Np, Iam, msgid, i, inc, mysrc, mydest, Np_1;
11 Int mydist, ringlen, myring;
12 Int nearedge, faredge;
14
16 if (Np < 2) return;
19 if (REBS = (dest == -1)) dest = 0;
20
21 if (nrings > 0)
22 {
23 mydist = (Np + dest - Iam) % Np;
24 inc = 1;
25 }
26 else
27 {
28 mydist = (Np + Iam - dest) % Np;
29 inc = -1;
30 nrings = -nrings;
31 }
32 Np_1 = Np - 1;
33 if (nrings > Np_1) nrings = Np_1;
34
35
36
37
38 if (Iam != dest)
39 {
40 ringlen = Np_1 / nrings;
41 myring = (mydist-1) / ringlen;
42 if (myring >= nrings) myring = nrings - 1;
43 nearedge = (myring*ringlen) + 1;
44 faredge = nearedge + ringlen - 1;
45 if (myring == nrings-1) faredge += Np_1 % nrings;
46 if (mydist == nearedge) mydest = dest;
47 else mydest = (Np + Iam + inc) % Np;
48 if (mydist != faredge)
49 {
50 BI_Srecv(ctxt, (Np + Iam - inc) % Np, msgid, bp2);
52 }
55 }
56
57
58
59 else
60 {
62 {
63 for(i=nrings; i; i--)
64 {
67 }
68 }
69 else
70 {
71 ringlen = Np_1 / nrings;
72 if (inc == 1) mysrc = (Np + Iam - 1) % Np;
73 else mysrc = (Iam + 1) % Np;
74 for(i=nrings; i; i--)
75 {
78 if (inc == 1) mysrc = (Np + mysrc - ringlen) % Np;
79 else mysrc = (mysrc + ringlen) % Np;
80 }
81 }
83 }
84}
void BI_MpathBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int src, Int npaths)
void BI_MpathBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int npaths)
void BI_Srecv(BLACSCONTEXT *ctxt, Int src, Int msgid, BLACBUFF *bp)
void BI_Ssend(BLACSCONTEXT *ctxt, Int dest, Int msgid, BLACBUFF *bp)
void(* SDRVPTR)(BLACSCONTEXT *, Int, Int, BLACBUFF *)