[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: immediate strings #2
From: |
Paul Eggert |
Subject: |
Re: immediate strings #2 |
Date: |
Mon, 28 Nov 2011 14:18:04 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 |
On 11/28/11 09:33, Stefan Monnier wrote:
> You need to move the immbit and gcmarkbit
> into the union :-(
Yes, something like this perhaps? It also adds a bit of checking for
underlying assumptions about word size.
#include <verify.h>
#define IMMEDIATE_STRING_LENGTH_BITS 7
struct Data_Lisp_String
{
unsigned int immediate_bit : 1;
signed int : IMMEDIATE_STRING_LENGTH_BITS; /* padding for immediate size */
unsigned int gcmarkbit : 1;
signed int : IMMEDIATE_STRING_LENGTH_BITS; /* and for immediate size_byte */
INTERVAL intervals;
ptrdiff_t size;
ptrdiff_t size_byte;
unsigned char *data;
};
#define IMMEDIATE_STRING_SIZE \
(sizeof (struct Data_Lisp_String) - offsetof (struct Data_Lisp_String, size))
verify (IMMEDIATE_STRING_SIZE <= 1 << (IMMEDIATE_STRING_LENGTH_BITS - 1));
struct Immediate_Lisp_String
{
unsigned int immediate_bit : 1;
signed int size : IMMEDIATE_STRING_LENGTH_BITS;
unsigned int gcmarkbit : 1;
signed int size_byte : IMMEDIATE_STRING_LENGTH_BITS;
INTERVAL intervals;
unsigned char data[IMMEDIATE_STRING_SIZE];
};
union Lisp_String
{
/* When IMMEDIATE.IMMEDIATE_BIT is 0. */
struct Data_Lisp_String data;
/* When IMMEDIATE.IMMEDIATE_BIT is 1. */
struct Immediate_Lisp_String immediate;
};
- Re: immediate strings #2, (continued)
- Re: immediate strings #2, Stefan Monnier, 2011/11/28
- Re: immediate strings #2, Ken Raeburn, 2011/11/28
- Re: immediate strings #2, Andreas Schwab, 2011/11/28
- Re: immediate strings #2, Stefan Monnier, 2011/11/28
- Re: immediate strings #2, Andreas Schwab, 2011/11/28
- Re: immediate strings #2, Ken Raeburn, 2011/11/28
- Re: immediate strings #2, Andreas Schwab, 2011/11/29
- Re: immediate strings #2, Ken Raeburn, 2011/11/29
- Re: immediate strings #2, Andreas Schwab, 2011/11/29
- Re: immediate strings #2, Ken Raeburn, 2011/11/30
Re: immediate strings #2,
Paul Eggert <=
- Re: immediate strings #2, Stefan Monnier, 2011/11/28
- Re: immediate strings #2, Dmitry Antipov, 2011/11/28
- Re: immediate strings #2, Paul Eggert, 2011/11/29
- Re: immediate strings #2, Dmitry Antipov, 2011/11/30
- Re: immediate strings #2, Paul Eggert, 2011/11/30
- Re: immediate strings #2, Ken Raeburn, 2011/11/30
- Re: immediate strings #2, Paul Eggert, 2011/11/30
Re: immediate strings #2, Dmitry Antipov, 2011/11/28
Re: immediate strings #2, Dmitry Antipov, 2011/11/29