1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-29 04:51:28 +00:00

GETBYTE macro returns value with signedness of char in BYTESWAP configurations but signedness of argument in non-BYTESWAP ones.

Replace use of GETBYTE macro in Get_SBYTE_PCMAC[01] macros as we cannot rely on passing signed argument type to get signed result.

	modified:   inc/inlineC.h
	modified:   inc/lsptypes.h
This commit is contained in:
Nick Briggs
2018-11-15 15:57:42 -08:00
parent 58c81a37b9
commit ac6bef0fab
2 changed files with 8 additions and 1 deletions

View File

@@ -41,8 +41,15 @@
#define Get_Pointer_PCMAC2 Get_Pointer(PCMAC + 2)
/* For getting a signed byte */
#ifndef BYTESWAP
/* in the unswapped case, the type of the argument carries through to the result */
#define Get_SBYTE_PCMAC0 GETBYTE((s_char *)PCMAC)
#define Get_SBYTE_PCMAC1 GETBYTE((s_char *)PCMAC+1)
#else
/* cf. GETBYTE in lsptypes.h */
#define Get_SBYTE_PCMAC0 (* (s_char *) (3^(UNSIGNED)(PCMAC)))
#define Get_SBYTE_PCMAC1 (* (s_char *) (3^(UNSIGNED)(PCMAC+1)))
#endif
/* for getting an atom number, e.g., for FNx or DTEST */
#ifdef BIGATOMS

View File

@@ -576,7 +576,7 @@ typedef struct
/* */
/****************************************************************/
#define GETBYTE(base) (* (char *) (3^(UNSIGNED)(base)))
#define GETBYTE(base) (* (unsigned char *) (3^(UNSIGNED)(base)))
/* GETBASEWORD only works if base points to a 32-bit bounday */
#define GETBASEWORD(base, offset) GETWORDBASEWORD((base),(offset))
#define GETWORDBASEWORD(base, offset) (* (DLword *) (2^(UNSIGNED)((base)+(offset))))