From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: immediate strings #2 Date: Tue, 29 Nov 2011 07:37:16 +0400 Message-ID: <4ED4536C.6040500@yandex.ru> References: <4ED35057.8010103@yandex.ru> <4ED4089C.3050203@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1322537826 24782 80.91.229.12 (29 Nov 2011 03:37:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 29 Nov 2011 03:37:06 +0000 (UTC) Cc: Paul Eggert , Stefan Monnier To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 29 04:37:02 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 1RVEVC-00071J-3l for ged-emacs-devel@m.gmane.org; Tue, 29 Nov 2011 04:37:02 +0100 Original-Received: from localhost ([::1]:53508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVEVB-0006RG-Ax for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2011 22:37:01 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVEV9-0006RB-LW for emacs-devel@gnu.org; Mon, 28 Nov 2011 22:37:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVEV8-000090-Hq for emacs-devel@gnu.org; Mon, 28 Nov 2011 22:36:59 -0500 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:51030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVEV8-00008V-Cb for emacs-devel@gnu.org; Mon, 28 Nov 2011 22:36:58 -0500 Original-Received: by bke17 with SMTP id 17so10698170bke.0 for ; Mon, 28 Nov 2011 19:36:57 -0800 (PST) Original-Received: by 10.204.156.208 with SMTP id y16mr48431382bkw.72.1322537817055; Mon, 28 Nov 2011 19:36:57 -0800 (PST) Original-Received: from [192.168.0.171] ([78.153.153.8]) by mx.google.com with ESMTPS id x14sm34054594bkf.10.2011.11.28.19.36.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Nov 2011 19:36:56 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.41 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:146333 Archived-At: Hm, this is still 40 bytes on 64-bit (and so 20 on 32-bit): struct Lisp_String { INTERVAL intervals; union { struct { unsigned gcmarkbit : 1; unsigned immbit : 1; EMACS_INT size : 7; EMACS_INT size_byte : 7; unsigned char data[STRING_IMM_MAX]; } imm; struct { unsigned unused : 2; EMACS_INT size : BITS_PER_EMACS_INT - 1; EMACS_INT size_byte : BITS_PER_EMACS_INT - 1; unsigned char *data; } dat; } u; }; The only way I found to fit it within 32 (or 16, respectively) bytes is: struct Lisp_String { INTERVAL intervals; union { struct { unsigned gcmarkbit : 1; unsigned immbit : 1; EMACS_INT size : 7; EMACS_INT size_byte : 7; unsigned char data[STRING_IMM_MAX]; } imm; struct { unsigned unused : 2; EMACS_INT size : BITS_PER_EMACS_INT - 1; EMACS_INT size_byte : BITS_PER_EMACS_INT - 1; unsigned char *data; } __attribute__ ((packed)) dat; } u; }; It's worth mentioning that only DAT should be packed, not IMM. Dmitry