Skip to main content

seq_delta

Function seq_delta 

Source
pub fn seq_delta(a: u16, b: u16) -> i16
Expand description

Wrap-aware signed difference of two 16-bit sequence numbers (a - b).

Every frame-id comparison must go through this. The prototype had a real bug from unsigned arithmetic: one reordered chunk from an older frame made the eviction sweep compute (old - current) & 0xFFFF ≈ 65500 for the frame being assembled and delete it.