lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] LWIP_U32_DIFF is unnecessarily complex


From: Mike Kleshov
Subject: Re: [lwip-devel] LWIP_U32_DIFF is unnecessarily complex
Date: Wed, 23 Nov 2011 13:03:50 +0400

Hello,

I missed the discussion about LWIP_U32_DIFF.
Mason, can you please provide a quote from the standard to support your finding?
All I could find is this (from C99):

A computation involving unsigned operands can never overflow,
because a result that cannot be represented by the resulting unsigned
integer type is
reduced modulo the number that is one greater than the largest value that can be
represented by the resulting type.

It mentions 'overflow' and 'reduced.' As far as I understand this, it
does not apply to subtraction. I can see two possibilities:
1) The authors of the standard forgot to mention 'underflow' and
'increased' to handle the subtraction case.
2) The standard really does not specify the behaviour of unsigned
integer underflow during subtraction, leaving it
implementation-defined.
Personally, I'm leaning towards 1), as it seems to make sense.

Any ideas?

Regards,
- Mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]