Fixed bug #29769 (sys_check_timeouts: sys_now() may overflow)

This commit is contained in:
goldsimon
2010-05-04 19:27:42 +00:00
parent abc36471d9
commit 71f5fdef42
3 changed files with 11 additions and 2 deletions

View File

@@ -47,6 +47,11 @@ extern "C" {
#define NULL ((void *)0)
#endif
/** Get the absolute difference between 2 u32_t values (correcting overflows)
* 'a' is expected to be 'higher' (without overflow) than 'b'. */
#define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1)))
/* Endianess-optimized shifting of two u8_t to create one u16_t */
#if BYTE_ORDER == LITTLE_ENDIAN
#define LWIP_MAKE_U16(a, b) ((a << 8) | b)
#else