On Tue, May 20, 2008 at 12:26 AM, funofnet Funofnet <[EMAIL PROTECTED]> wrote: > Hi, > > this is where I suspect the bug : LinkEstimatorP.nc > > ********************************** > > j = 0; > newPrevSentIdx = 0; > > NEIGHBOR_TABLE_SIZE = 10 // I added to have all the constants mentionned > for (i = 0; i < NEIGHBOR_TABLE_SIZE && j < maxEntries; i++) { > k = (prevSentIdx + i + 1) % NEIGHBOR_TABLE_SIZE; > if ((NeighborTable[k].flags & VALID_ENTRY) && > (NeighborTable[k].flags & MATURE_ENTRY)) { > footer->neighborList[j].ll_addr = NeighborTable[k].ll_addr; > footer->neighborList[j].inquality = NeighborTable[k].inquality; > newPrevSentIdx = k; > dbg("LI", "Loaded on footer: %d %d %d\n", j, > footer->neighborList[j].ll_addr, > footer->neighborList[j].inquality); > j++; > } > } > > *********************************** > > Normally footer->neighborList[] should contain distinct neighbour but in the > case where the second and last element in the > > NeighborTable are mature and valid only element index 1 will be insert. > Isn't it? > > I explain more: > > > > k = 0 + 0 + 1 % 10 = 1 (NeighborTable[1] is mature and valid) then > > footer->neighborList[0].ll_addr = NeighborTable[1].ll_addr; > footer->neighborList[0].inquality = NeighborTable[1].inquality; > > > > then we continue until * i = 9 * > > k = 1 + 9 + 1 = 11 % 10 = 1 (NeighborTable[1] is mature and valid) then
You are updating prevSentIdx in the expression above to 1 - that happens only after you exit the for loop. The correct expression should be 0 + 9 + 1 = 10 % 10 = 0 so I don't think this is a bug. Does this make sense? - om_p _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help