From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: support 64-bit EMACS_INT on 32-bit hosts Date: Fri, 29 Apr 2011 01:56:40 -0700 Organization: UCLA Computer Science Department Message-ID: <4DBA7D48.8050109@cs.ucla.edu> References: <4DBA71FB.5090900@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1304067417 21848 80.91.229.12 (29 Apr 2011 08:56:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 29 Apr 2011 08:56:57 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 29 10:56:53 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QFjVN-0000KE-4f for ged-emacs-devel@m.gmane.org; Fri, 29 Apr 2011 10:56:53 +0200 Original-Received: from localhost ([::1]:38262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFjVM-0000yW-I3 for ged-emacs-devel@m.gmane.org; Fri, 29 Apr 2011 04:56:52 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFjVJ-0000yN-K0 for emacs-devel@gnu.org; Fri, 29 Apr 2011 04:56:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFjVI-0002IM-Lw for emacs-devel@gnu.org; Fri, 29 Apr 2011 04:56:49 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:36594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFjVI-0002I6-F4 for emacs-devel@gnu.org; Fri, 29 Apr 2011 04:56:48 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 2315D39E8106 for ; Fri, 29 Apr 2011 01:56:47 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KzbpG1m50NwO for ; Fri, 29 Apr 2011 01:56:46 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 8B2CD39E80DB for ; Fri, 29 Apr 2011 01:56:46 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: <4DBA71FB.5090900@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138889 Archived-At: On 04/29/11 01:08, Paul Eggert wrote: > Step 2 will change EMACS_INT to be 64 bits on 32+64-bit ports. > That is a bigger deal, and I'll send a later email about it. Here's a simple patch to do this. With this patch (atop the previous one), I've successfully used Emacs to edit a 2 GB file on an x86 (32-bit) platform. I've only done very limited testing with this patch, though, and I don't plan to install this patch right now; it needs more testing. However, I thought I'd publish it now as a heads-up. * lisp.h: Prefer 64-bit EMACS_INT if available. (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Define to 64-bit on 32-bit hosts that have 64-bit int, so that they can access large files. === modified file 'src/lisp.h' --- src/lisp.h 2011-04-29 07:54:43 +0000 +++ src/lisp.h 2011-04-29 08:48:05 +0000 @@ -44,7 +44,16 @@ #ifndef EMACS_UINT #define EMACS_UINT unsigned long #endif -#else /* not _LP64 */ +#elif /* !_LP64 && */ BITS_PER_LONG < BITS_PER_LONG_LONG +#ifndef EMACS_INT +#define EMACS_INT long long +#define BITS_PER_EMACS_INT BITS_PER_LONG_LONG +#define pI "ll" +#endif +#ifndef EMACS_UINT +#define EMACS_UINT unsigned long long +#endif +#else /* ! (_LP64 || BITS_PER_LONG < BITS_PER_LONG_LONG) */ #ifndef EMACS_INT #define EMACS_INT int #define BITS_PER_EMACS_INT BITS_PER_INT