comparison src/lisp-disunion.h @ 201:eb5470882647 r20-3b27

Import from CVS: tag r20-3b27
author cvs
date Mon, 13 Aug 2007 10:01:22 +0200
parents 3d6bfa290dbd
children e45d5e7c476e
comparison
equal deleted inserted replaced
200:f0deb0c0e6be 201:eb5470882647
39 39
40 In strings, this bit in the size field indicates that the string 40 In strings, this bit in the size field indicates that the string
41 is a "large" one, one which was separately malloc'd 41 is a "large" one, one which was separately malloc'd
42 rather than being part of a string block. */ 42 rather than being part of a string block. */
43 43
44 #define MARKBIT (1UL << ((VALBITS) + (GCTYPEBITS))) 44 #define MARKBIT (1UL << (VALBITS))
45 45
46 46
47 /* These macros extract various sorts of values from a Lisp_Object. 47 /* These macros extract various sorts of values from a Lisp_Object.
48 For example, if tem is a Lisp_Object whose type is Lisp_Type_Cons, 48 For example, if tem is a Lisp_Object whose type is Lisp_Type_Cons,
49 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */ 49 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
50 50
51 /* One needs to override this if there must be high bits set in data space 51 /* One needs to override this if there must be high bits set in data space
52 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work 52 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
53 on all machines, but would penalize machines which don't need it) */ 53 on all machines, but would penalize machines which don't need it) */
54 #define XTYPE(a) ((enum Lisp_Type) ((a) >> VALBITS)) 54 #define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT)(a)) >> ((VALBITS) + 1)))
55 55
56 #define EQ(x,y) ((x) == (y)) 56 #define EQ(x,y) ((x) == (y))
57 #define GC_EQ(x,y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y)) 57 #define GC_EQ(x,y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
58 58
59 /* Extract the value of a Lisp_Object as a signed integer. */ 59 /* Extract the value of a Lisp_Object as a signed integer. */
92 /* XSETOBJ was formerly named XSET. The name change was made to catch 92 /* XSETOBJ was formerly named XSET. The name change was made to catch
93 C code that attempts to use this macro. You should always use the 93 C code that attempts to use this macro. You should always use the
94 individual settor macros (XSETCONS, XSETBUFFER, etc.) instead. */ 94 individual settor macros (XSETCONS, XSETBUFFER, etc.) instead. */
95 95
96 #define XSETOBJ(var, type_tag, value) \ 96 #define XSETOBJ(var, type_tag, value) \
97 ((void) ((var) = (((EMACS_INT) (type_tag) << VALBITS) \ 97 ((void) ((var) = (((EMACS_INT) (type_tag) << ((VALBITS) + 1)) \
98 + ((EMACS_INT) (value) & VALMASK)))) 98 + ((EMACS_INT) (value) & VALMASK))))
99 99
100 /* During garbage collection, XGCTYPE must be used for extracting types 100 /* During garbage collection, XGCTYPE must be used for extracting types
101 so that the mark bit is ignored. XMARKBIT accesses the markbit. 101 so that the mark bit is ignored. XMARKBIT accesses the markbit.
102 Markbits are used only in particular slots of particular structure types. 102 Markbits are used only in particular slots of particular structure types.
103 Other markbits are always zero. 103 Other markbits are always zero.
104 Outside of garbage collection, all mark bits are always zero. */ 104 Outside of garbage collection, all mark bits are always zero. */
105 105
106 #ifndef XGCTYPE 106 #ifndef XGCTYPE
107 # define XGCTYPE(a) ((enum Lisp_Type) (((a) >> VALBITS) & GCTYPEMASK)) 107 # define XGCTYPE(a) XTYPE(a)
108 #endif 108 #endif
109 109
110 #if ((VALBITS) + (GCTYPEBITS)) == ((LONGBITS) - 1L)
111 /* Make XMARKBIT faster if mark bit is sign bit. */
112 # define XMARKBIT(a) ((a) < 0L)
113 #else
114 # define XMARKBIT(a) ((a) & (MARKBIT)) 110 # define XMARKBIT(a) ((a) & (MARKBIT))
115 #endif /* markbit is sign bit */
116 111
117 # define XMARK(a) ((void) ((a) |= (MARKBIT))) 112 # define XMARK(a) ((void) ((a) |= (MARKBIT)))
118 # define XUNMARK(a) ((void) ((a) &= (~(MARKBIT)))) 113 # define XUNMARK(a) ((void) ((a) &= (~(MARKBIT))))
119 114
120 /* Use this for turning a (void *) into a Lisp_Object, as when the 115 /* Use this for turning a (void *) into a Lisp_Object, as when the