Fix rxcost computation
This commit is contained in:
parent
650a9e8827
commit
ec6a57a218
1 changed files with 5 additions and 1 deletions
|
@ -55,7 +55,11 @@ uint16_t ffd_neigh_get_rxcost(const ffd_neigh_t *neigh) {
|
||||||
|
|
||||||
int timediff = timespec_diff(&now, &neigh->last_hello);
|
int timediff = timespec_diff(&now, &neigh->last_hello);
|
||||||
int shift = (timediff - neigh->hello_interval/2)/neigh->hello_interval;
|
int shift = (timediff - neigh->hello_interval/2)/neigh->hello_interval;
|
||||||
int received = __builtin_popcount(neigh->hello_log << shift);
|
|
||||||
|
if (shift >= 16)
|
||||||
|
return 0xffff;
|
||||||
|
|
||||||
|
int received = __builtin_popcount((neigh->hello_log << shift) & 0xffff);
|
||||||
|
|
||||||
if (received == 0)
|
if (received == 0)
|
||||||
return 0xffff;
|
return 0xffff;
|
||||||
|
|
Reference in a new issue