From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: documentation of integers, fixnums and bignums Date: Sun, 09 Sep 2018 08:40:35 +0300 Message-ID: <83tvmzqld8.fsf@gnu.org> References: <0f632217-27ad-4f54-8ce0-480301fa2a86@cs.ucla.edu> <83pnxorm37.fsf@gnu.org> <92915cae-21d5-c365-89f2-3a15fc9114c4@cs.ucla.edu> <7f7411eb-32c8-9ea6-8ead-2aaf603d3901@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1536471853 5057 195.159.176.226 (9 Sep 2018 05:44:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Sep 2018 05:44:13 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 09 07:44:09 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fysVz-0001CE-IW for ged-emacs-devel@m.gmane.org; Sun, 09 Sep 2018 07:44:07 +0200 Original-Received: from localhost ([::1]:46148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fysY6-0001rT-07 for ged-emacs-devel@m.gmane.org; Sun, 09 Sep 2018 01:46:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fysWz-0001dU-4A for emacs-devel@gnu.org; Sun, 09 Sep 2018 01:45:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fysSV-0004q6-6M for emacs-devel@gnu.org; Sun, 09 Sep 2018 01:40:34 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33129) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fysSV-0004q0-2s; Sun, 09 Sep 2018 01:40:31 -0400 Original-Received: from [176.228.60.248] (port=1629 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fysSU-0007Bn-MC; Sun, 09 Sep 2018 01:40:31 -0400 In-reply-to: <7f7411eb-32c8-9ea6-8ead-2aaf603d3901@cs.ucla.edu> (message from Paul Eggert on Sat, 8 Sep 2018 16:37:26 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:229539 Archived-At: > From: Paul Eggert > Date: Sat, 8 Sep 2018 16:37:26 -0700 > > >> When INDEX_TO_CODE_POINT returns a code point greater than > >> most-positive-fixnum, which can happen (in theory, at least) on 32-bit > >> platforms. > > > > Can it, really? > > I don't know of any way it could happen. So what you're saying is that we should > install something like the attached patch? The log message you made in commit 3c7649c says: Don't rely on undefined behavior with signed left shift overflow. Don't assume unsigned int fits into fixnum, or that fixnum fits into unsigned int. Don't require max_code to be a valid fixnum; that's not true for gb10830 4-byte on a 32-bit host. And indeed, etc/charsets/gb108304.map clearly shows codepoints like 0x81308130, which will overflow the 32-bit most-positive-fixnum. (These codepoints are just a concatenation of the 4 bytes of the GB 10830 encoding, see https://en.wikipedia.org/wiki/GB_18030). > Also, how about glyph-ids returned by font-variation-glyphs? Can they exceed > fixnum range? If not, font-variation-glyphs could see a similar speedup. They are glyph IDs of some font. Does anyone know what are the limits for values of font glyph IDs? I'm not an expert on fonts.