unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: t_tuneyosi@hotmail.com, Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?
Date: Sat, 24 Oct 2009 12:01:20 +0200	[thread overview]
Message-ID: <m21vktun4f.fsf@whitebox.home> (raw)
In-Reply-To: <83tyxpf8zy.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 24 Oct 2009 11:15:29 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stefan Monnier <monnier@iro.umontreal.ca>
>> Date: Fri, 23 Oct 2009 21:05:05 -0400
>> Cc: t_tuneyosi@hotmail.com, Andreas Schwab <schwab@linux-m68k.org>,
>> 	emacs-devel@gnu.org
>> 
>> 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, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




  parent reply	other threads:[~2009-10-24 10:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 17:51 macro FIXNUM_OVERFLOW_P in lisp.h is valid ? Toru TSUNEYOSHI
2009-10-23 19:33 ` Eli Zaretskii
2009-10-24  1:50   ` Toru TSUNEYOSHI
2009-10-24  9:05     ` Eli Zaretskii
2009-10-24 11:59       ` Toru TSUNEYOSHI
2009-10-24 13:00         ` Eli Zaretskii
2009-10-24 18:45           ` Toru TSUNEYOSHI
2009-10-24 15:14         ` Andreas Schwab
2009-10-24 18:39           ` Stefan Monnier
2009-10-26 14:48           ` Toru TSUNEYOSHI
     [not found]   ` <20091024.105033.100383844.t_tuneyosi@hotmail.com>
2009-10-24  6:07     ` Toru TSUNEYOSHI
     [not found]     ` <20091024.150744.186061320.t_tuneyosi@hotmail.com>
2009-10-24  7:46       ` Toru TSUNEYOSHI
2009-10-24 10:11         ` Eli Zaretskii
2009-10-23 20:57 ` Andreas Schwab
2009-10-23 22:02   ` Eli Zaretskii
2009-10-24  1:05     ` Stefan Monnier
2009-10-24  9:15       ` Eli Zaretskii
2009-10-24  9:40         ` Andreas Schwab
2009-10-24 10:16           ` Eli Zaretskii
2009-10-24 10:01         ` Andreas Schwab [this message]
2009-10-23 21:14 ` Stefan Monnier
2009-10-25  8:51   ` Toru TSUNEYOSHI
     [not found]   ` <20091025.175131.55657724.t_tuneyosi@hotmail.com>
2009-10-25 11:30     ` Toru TSUNEYOSHI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21vktun4f.fsf@whitebox.home \
    --to=schwab@linux-m68k.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=t_tuneyosi@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).