m4-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] src/freeze.c (GET_NUMBER): Fix a typo.


From: Jim Meyering
Subject: Re: [PATCH] src/freeze.c (GET_NUMBER): Fix a typo.
Date: Sun, 11 May 2008 18:51:10 +0200

Eric Blake <address@hidden> wrote:
> According to Jim Meyering on 5/11/2008 7:00 AM:
> | Thanks for humoring me ;-)
> | Maybe the test suite never exercises this case?
>
> Actually, the master branch DOES exercise it.  And it passed without your
> patch, because...
>
> |     }                                                       \
> | -      if (((AllowNeg) ? INT_MIN: INT_MAX) < n                      \
> | +      if (((AllowNeg) ? -INT_MIN : INT_MAX) < n                    \
>
> ...n is unsigned.  -INT_MIN == INT_MIN on 2's complement machines (and ==
> INT_MAX on 1's complement machines, if I remember correctly).  But whether
> the int on the left is INT_MIN or INT_MAX, upon conversion to unsigned for
> comparison with n on the right, it should result in the correct unsigned
> version of INT_MAX or (unsigned)INT_MAX + 1, depending on whether the
> machine is 2's complement.

I should have known better -- or just tried it.
You have to admit it sure does *look* fishy.




reply via email to

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