mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix: handle new size of sequence number correctly during overflow
This commit is contained in:
parent
93aca598f1
commit
bacba17c5c
1 changed files with 3 additions and 3 deletions
|
@ -97,9 +97,9 @@ skip: for(;;) {
|
|||
}
|
||||
|
||||
/* Handle wrap-around of sequence number */
|
||||
int dist = (UINT16_MAX + p->current->sequence - p->previous->sequence) % UINT16_MAX;
|
||||
if (dist > UINT16_MAX / 2)
|
||||
dist -= UINT16_MAX;
|
||||
int dist = (UINT32_MAX + p->current->sequence - p->previous->sequence) % UINT32_MAX;
|
||||
if (dist > UINT32_MAX / 2)
|
||||
dist -= UINT32_MAX;
|
||||
|
||||
/* Update sequence histogram */
|
||||
hist_put(&p->hist_seq, dist);
|
||||
|
|
Loading…
Add table
Reference in a new issue