[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] LWIP_U32_DIFF is unnecessarily complex
From: |
Stephane Lesage |
Subject: |
Re: [lwip-devel] LWIP_U32_DIFF is unnecessarily complex |
Date: |
Wed, 24 Aug 2011 14:41:27 +0200 |
> src/include/lwip/def.h defines LWIP_U32_DIFF
> a macro which used to compute the difference between two
> u32_t values, taking wrap-around into account.
> [...]
> Therefore LWIP_U32_DIFF reduces to
> #define LWIP_U32_DIFF(a, b) ((a)-(b))
> I suggest removing the macro altogether, and applying the
> following patch.
Hi,
This is what I also do in my sys_arch layer and programs.
With 2's complement arithmetic you can just substract.
I checked it.
But you need to make sure that both operands are the same size.
Should we keep the macro for clarity ?