[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?
From: |
Andreas Schwab |
Subject: |
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ? |
Date: |
Sat, 24 Oct 2009 12:01:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
>> From: Stefan Monnier <address@hidden>
>> Date: Fri, 23 Oct 2009 21:05:05 -0400
>> Cc: address@hidden, Andreas Schwab <address@hidden>,
>> address@hidden
>>
>> Actually, when the cast was added in 2001, it came with the following
>> commit-log-comment:
>>
>> (FIXNUM_OVERFLOW_P): Cast I to EMACS_INT in comparisons
>> in case I is of some unsigned type, in which case
>> MOST_NEGATIVE_FIXNUM will be converted to unsigned, and the
>> comparison becomes bogus.
>
> Right, sorry for my failing memory.
>
> So I think the change made yesterday by Andreas should be reverted.
These should also work with unsigned types, but may generate extra
warnings:
#define FIXNUM_OVERFLOW_P(i) \
(((i) > 0 && (i) > MOST_POSITIVE_FIXNUM) \
|| ((i) < 0 && (i) < MOST_NEGATIVE_FIXNUM))
or:
#define FIXNUM_OVERFLOW_P(i) \
!((i) <= MOST_POSITIVE_FIXNUM \
&& (i) >= MOST_NEGATIVE_FIXNUM)
Andreas.
--
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Andreas Schwab, 2009/10/23
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Stefan Monnier, 2009/10/23