[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] TCP_SEQ_BETWEEN
From: |
Leon Woestenberg |
Subject: |
[lwip-users] TCP_SEQ_BETWEEN |
Date: |
Thu, 14 Oct 2004 14:29:53 +0200 |
Hello,
I have just reverted the TCP_SEQ_BETWEEN macro as suggested by Bill
Knight, as it fails on his ARM target.
In reviewing the macro, I got lost in simple math. The aim of the
macro is to verify that:
(b<=a<=c)
==
(b<=a) and (a<=c)
==
(0<=a-b) and (0<=c-a)
However, the current macro TCP_SEQ_BETWEEN
(c-b>=a-b) merely checks that (c>=a)
Was this an intentional simplification?
Regards,
Leon Woestenberg.
#define TCP_SEQ_LT(a,b) ((s32_t)((a)-(b)) < 0)
#define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b)) <= 0)
#define TCP_SEQ_GT(a,b) ((s32_t)((a)-(b)) > 0)
#define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b)) >= 0)
/* is b<=a<=c? */
#if 0 /* see bug #10548 */
#define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
#endif
#define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
- [lwip-users] TCP_SEQ_BETWEEN,
Leon Woestenberg <=