# HG changeset patch # User Stefan Monnier # Date 1069111770 0 # Node ID 63a8b584e971964c13a43043d360ddf5327283ee # Parent 858cdfcb7635774669be86da9752a21fafc0d70b (VALMASK): Only define for non-union type. (MARKBIT): Remove. (ARRAY_MARK_FLAG): Use previous value of MARKBIT. (XTYPE): Define unconditionally. (XSETTYPE): Remove one more remnant. (EQ): Define differently for the union and non-union cases. (INTMASK): New bit mask. (struct Lisp_Marker): Move down to prepare for upcoming patch. (GC_EQ): Delegate to EQ. diff -r 858cdfcb7635 -r 63a8b584e971 src/lisp.h --- a/src/lisp.h Mon Nov 17 23:23:15 2003 +0000 +++ b/src/lisp.h Mon Nov 17 23:29:30 2003 +0000 @@ -250,24 +250,13 @@ #define LISP_MAKE_RVALUE(o) (0+(o)) #endif /* NO_UNION_TYPE */ -#ifndef VALMASK -#define VALMASK ((((EMACS_INT) 1)<> 1) & ~MARKBIT) +#define ARRAY_MARK_FLAG ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1))) #endif /* no ARRAY_MARK_FLAG */ /* In the size word of a struct Lisp_Vector, this bit means it's really @@ -310,20 +299,17 @@ #ifdef NO_UNION_TYPE +#define VALMASK ((((EMACS_INT) 1) << VALBITS) - 1) + /* One need to override this if there must be high bits set in data space (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work on all machines, but would penalize machines which don't need it) */ -#ifndef XTYPE #define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS)) -#endif /* For integers known to be positive, XFASTINT provides fast retrieval and XSETFASTINT provides fast storage. This takes advantage of the - fact that Lisp_Int is 0. - Beware: XFASTINT applied to a non-positive integer or to something - else than an integer should return something that preserves all the - info that was in the Lisp_Object, because it is used in EQ. */ + fact that Lisp_Int is 0. */ #define XFASTINT(a) ((a) + 0) #define XSETFASTINT(a, b) ((a) = (b)) @@ -351,12 +337,11 @@ #define make_number(N) \ ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) -#endif /* NO_UNION_TYPE */ - -#ifndef NO_UNION_TYPE +#define EQ(x, y) ((x) == (y)) + +#else /* not NO_UNION_TYPE */ #define XTYPE(a) ((enum Lisp_Type) (a).u.type) -#define XSETTYPE(a, b) ((a).u.type = (char) (b)) /* For integers known to be positive, XFASTINT provides fast retrieval and XSETFASTINT provides fast storage. This takes advantage of the @@ -384,6 +369,8 @@ extern Lisp_Object make_number (); #endif +#define EQ(x, y) ((x).s.val == (y).s.val) + #endif /* NO_UNION_TYPE */ /* During garbage collection, XGCTYPE must be used for extracting types @@ -394,7 +381,7 @@ #ifndef XGCTYPE /* The distinction does not exist now that the MARKBIT has been eliminated. */ -#define XGCTYPE(a) XTYPE(a) +#define XGCTYPE(a) XTYPE (a) #endif #ifndef XPNTR @@ -422,6 +409,9 @@ #define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1)) #define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1) +/* Mask indicating the significant bits of a Lisp_Int. + I.e. (x & INTMASK) == XUINT (make_number (x)). */ +#define INTMASK ((((EMACS_INT) 1) << VALBITS) - 1) /* Value is non-zero if C integer I doesn't fit into a Lisp fixnum. */ @@ -989,15 +979,6 @@ /* These structures are used for various misc types. */ -/* A miscellaneous object, when it's on the free list. */ -struct Lisp_Free - { - int type : 16; /* = Lisp_Misc_Free */ - unsigned gcmarkbit : 1; - int spacer : 15; - union Lisp_Misc *chain; - }; - struct Lisp_Marker { int type : 16; /* = Lisp_Misc_Marker */ @@ -1162,6 +1143,15 @@ }; +/* A miscellaneous object, when it's on the free list. */ +struct Lisp_Free + { + int type : 16; /* = Lisp_Misc_Free */ + unsigned gcmarkbit : 1; + int spacer : 15; + union Lisp_Misc *chain; + }; + /* To get the type field of a union Lisp_Misc, use XMISCTYPE. It uses one of these struct subtypes to get the type field. */ @@ -1321,7 +1311,7 @@ #define GC_NATNUMP(x) (GC_INTEGERP (x) && XINT (x) >= 0) #define INTEGERP(x) (XTYPE ((x)) == Lisp_Int) -#define GC_INTEGERP(x) (XGCTYPE ((x)) == Lisp_Int) +#define GC_INTEGERP(x) INTEGERP (x) #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) #define GC_SYMBOLP(x) (XGCTYPE ((x)) == Lisp_Symbol) #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) @@ -1392,8 +1382,7 @@ #define SUB_CHAR_TABLE_P(x) (CHAR_TABLE_P (x) && NILP (XCHAR_TABLE (x)->top)) -#define EQ(x, y) (XFASTINT (x) == XFASTINT (y)) -#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y)) +#define GC_EQ(x, y) EQ (x, y) #define CHECK_LIST(x) \ do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)