From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Integer & glyph (trunk and emacs_unicode) Date: Thu, 15 Nov 2007 16:12:11 -0500 Message-ID: References: <473CB6F4.6090002@ig.com.br> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1195161221 27061 80.91.229.12 (15 Nov 2007 21:13:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Nov 2007 21:13:41 +0000 (UTC) Cc: "GNU Emacs \(devel\)" To: Vinicius Jose Latorre Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 15 22:13:45 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ism1u-0002Yy-Mf for ged-emacs-devel@m.gmane.org; Thu, 15 Nov 2007 22:13:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ism1h-00006j-QH for ged-emacs-devel@m.gmane.org; Thu, 15 Nov 2007 16:13:29 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ism0b-0008KU-AZ for emacs-devel@gnu.org; Thu, 15 Nov 2007 16:12:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ism0Y-0008JT-RG for emacs-devel@gnu.org; Thu, 15 Nov 2007 16:12:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ism0Y-0008JO-Gt for emacs-devel@gnu.org; Thu, 15 Nov 2007 16:12:18 -0500 Original-Received: from vpn-132-204-232-80.acd.umontreal.ca ([132.204.232.80] helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ism0Y-0005M5-BD for emacs-devel@gnu.org; Thu, 15 Nov 2007 16:12:18 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id C54A7B4059; Thu, 15 Nov 2007 16:12:11 -0500 (EST) In-Reply-To: <473CB6F4.6090002@ig.com.br> (Vinicius Jose Latorre's message of "Thu, 15 Nov 2007 18:15:32 -0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:83295 Archived-At: > (defun make-glyph-code (char &optional face) > "Return a glyph code representing char CHAR with face FACE." > ;; Due to limitations on Emacs integer values, faces with > ;; face id greater that 4091 are silently ignored. > (if (and face (<= (face-id face) #xfff)) > (logior char (lsh (face-id face) 19)) > char)) > So, it assumes 12 bits for face id and 19 bits for char code, > the result is an integer of 31 bits. I suspect that the "19" used to be something else (e.g. 16 when integers were 28bits, so 16+12=28). In any case, the test should be made more robust by not assuming anything about the available range of integers (which has changed over the years and can change depending on your config). How 'bout (let ((id (and face (face-id face))) (if (and (numberp id) ;; Due to limitations on Emacs integer values, only ;; face ids below a certain limit can be used. (= id (lsh (lsh id 19) -19))) (logior char (lsh id 19)) char)) -- Stefan