From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: Removing some workarounds for big integers Date: Mon, 22 Apr 2019 17:43:57 +0100 Message-ID: <86lg02our6.fsf@gmail.com> References: <86d0uck5o0.fsf@gmail.com> <15786884-92c4-efb0-58d3-a6ec6726a0fe@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="260479"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 22 18:55:48 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIcEO-0015fq-EG for ged-emacs-devel@m.gmane.org; Mon, 22 Apr 2019 18:55:48 +0200 Original-Received: from localhost ([127.0.0.1]:40085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIcEN-0001Yu-Ba for ged-emacs-devel@m.gmane.org; Mon, 22 Apr 2019 12:55:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIcDs-0000mY-Bv for emacs-devel@gnu.org; Mon, 22 Apr 2019 12:55:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIc35-0008ND-OS for emacs-devel@gnu.org; Mon, 22 Apr 2019 12:44:09 -0400 Original-Received: from [195.159.176.226] (port=48402 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIc33-0008LU-UG for emacs-devel@gnu.org; Mon, 22 Apr 2019 12:44:06 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hIc30-000rDd-Lw for emacs-devel@gnu.org; Mon, 22 Apr 2019 18:44:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:sB1QOsMAVRLKOiypbAbRVqCaxJU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235774 Archived-At: On Mon 22 Apr 2019, Philipp Stephani wrote: > Am Sa., 22. Sept. 2018 um 01:12 Uhr schrieb Paul Eggert : >> >> Philipp Stephani wrote: >> >> > It looks like Paul has already done most of this work in commit >> > d77d01d22902acdc45c2c7059de4f1b158ab5806. >> >> Yes, I've already replaced all uses of make_fixnum_or_float and INTEGER_TO_CONS >> with INT_TO_INTEGER. >> >> There are still quite a few places that need looking at, though. Stefan >> mentioned timestamps; I'll try to bump the priority of that. > > I've checked some of the remaining uses of CONS_TO_INTEGER. It seems > some of them we can replace right away. For some others the > documentation requires a number; we can detect integral floats for > them, but should deprecate the float usage. In commit 4e2ea400 ("Introduce a helper macro to convert a Lisp integer to a C integer."): +/* Return the integral value of NUM. If NUM is too big for TYPE, + signal an error. */ +#define INTEGER_TO_INT(num, type) \ + (TYPE_SIGNED (type) \ + ? ranged_integer_to_int ((num), TYPE_MINIMUM (type), TYPE_MAXIMUM (type)) \ + : ranged_integer_to_uint ((num), TYPE_MINIMUM (type))) ^^^^^^^^^^^^ This should be TYPE_MAXIMUM. AndyM