help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

adress of lisp object is multiple of 8


From: A Soare
Subject: adress of lisp object is multiple of 8
Date: Tue, 8 May 2007 18:04:10 +0200 (CEST)

Here is the definition of a lisp object.

typedef
union Lisp_Object
  {
    /* Used for comparing two Lisp_Objects;
       also, positive integers can be accessed fast this way.  */
    EMACS_INT i;

    struct
      {
        EMACS_INT val  : VALBITS;
        enum Lisp_Type type : GCTYPEBITS;
      } s;
    struct
      {
        EMACS_UINT val : VALBITS;
        enum Lisp_Type type : GCTYPEBITS;
      } u;
  }
Lisp_Object;

It is memorised on 32 bits. First 3 bits represents the type of object. The 
others 29 represent a pointer to a structure of that type of object. For 
example, if adress & 7 is 5, that means that the integer formed of the 29 bits 
points to a Lisp_Cons.

I do not understand how can I be sure that when the lisp allocs a new space of 
memory for a given object from enum Lisp_Type, it is allocated to an adress 
that is multiple of 8 ?

Thanks in advance.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]