|
From: | address@hidden |
Subject: | Re: [lwip-devel] Question on comparations of sequence numbers |
Date: | Fri, 23 Dec 2011 09:34:04 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
narke wrote:
#define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b))<= 0) #define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b))>= 0) so it means, a is within [b, c] iif b<= a<= c
In window-numbers, your example is correct, but not in integer arithmetic.
I'm not sure I understand your example numbers. Should 3 be the smallest sequence number and 1 be the highest sequence number? How can that be if the biggest possible window size is 65535? If you meant it the other way round, 0 is outside of the window, isn't it?However, because sequence number cycles (module 2**32), so I cannot understand why a - b>= 0 mean a>= b or a - c<= 0 means a<= c. For example, in a 2 bit window, and a window could be [3, 1] and 0 falls in the window. But here 3<= 0<= 1 does not hold.
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |