X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Flisp-disunion.h;h=47c36260aa93d31f48bbc307a445fb4ccb1604dd;hb=a94c84beadc87325e2bfa14f85ab48fe5d965c36;hp=2343e0405f63c2265ece01ac6c375995a42f2b3b;hpb=40402600969429d5253e62c6314a3eebbb21f027;p=chise%2Fxemacs-chise.git.1 diff --git a/src/lisp-disunion.h b/src/lisp-disunion.h index 2343e04..47c3626 100644 --- a/src/lisp-disunion.h +++ b/src/lisp-disunion.h @@ -41,7 +41,7 @@ Boston, MA 02111-1307, USA. */ bits are the Lisp object. Some people call such Lisp_Objects "immediate". The object is obtained by masking off the type bits. - Bit 1 is used as a value bit by splitting the Lisp integer type + Bit 1 is used as a value bit by splitting the Lisp integer type into two subtypes, Lisp_Type_Int_Even and Lisp_Type_Int_Odd. By this trickery we get 31 bits for integers instead of 30. @@ -49,7 +49,7 @@ Boston, MA 02111-1307, USA. */ a pointer to a structure containing the object. The pointer is obtained by masking off the type and mark bits. - All pointer-based types are coalesced under a single type called + All pointer-based types are coalesced under a single type called Lisp_Type_Record. The type bits for this type are required by the implementation to be 00, just like the least significant bits of word-aligned struct pointers on 32-bit hardware. This requires that @@ -79,12 +79,26 @@ typedef EMACS_INT Lisp_Object; #define Lisp_Type_Int_Bit (Lisp_Type_Int_Even & Lisp_Type_Int_Odd) #define wrap_object(ptr) ((Lisp_Object) (ptr)) -#define make_int(x) ((Lisp_Object) (((x) << INT_GCBITS) | Lisp_Type_Int_Bit)) -#define make_char(x) ((Lisp_Object) (((x) << GCBITS) | Lisp_Type_Char)) +#define make_int(x) ((Lisp_Object) (((EMACS_INT)(x) << INT_GCBITS) | Lisp_Type_Int_Bit)) +#define make_char(x) ((Lisp_Object) (((EMACS_INT)(x) << GCBITS) | Lisp_Type_Char)) #define VALMASK (((1UL << VALBITS) - 1UL) << GCTYPEBITS) #define XTYPE(x) ((enum Lisp_Type) (((EMACS_UINT)(x)) & ~VALMASK)) #define XPNTRVAL(x) (x) /* This depends on Lisp_Type_Record == 0 */ -#define XCHARVAL(x) ((x) >> GCBITS) +#if defined(UTF2000) && (SIZEOF_EMACS_INT == 4) +INLINE_HEADER Emchar XCHARVAL (Lisp_Object chr); +INLINE_HEADER Emchar +XCHARVAL (Lisp_Object chr) +{ + int code = (EMACS_UINT)(chr) >> GCBITS; + + if (code & 0x20000000) + return code | 0x40000000; + else + return code; +} +#else +#define XCHARVAL(x) ((Emchar)((EMACS_UINT)(x) >> GCBITS)) +#endif #define XREALINT(x) ((x) >> INT_GCBITS) #define XUINT(x) ((EMACS_UINT)(x) >> INT_GCBITS) #define INTP(x) ((EMACS_UINT)(x) & Lisp_Type_Int_Bit)