From 15f28c3a8cbf95a6bb9abb908b17de90576c7a49 Mon Sep 17 00:00:00 2001 From: acqn Date: Thu, 13 Aug 2020 08:24:40 +0800 Subject: [PATCH] Fixed getting the basic raw type names. --- src/cc65/datatype.c | 4 ++-- src/cc65/datatype.h | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index 9b30eba70..20c4abc56 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -235,7 +235,7 @@ const char* GetBasicTypeName (const Type* T) default: break; } if (IsClassInt (T)) { - if (IsSignSigned (T)) { + if (IsRawSignSigned (T)) { switch (GetRawType (T)) { case T_TYPE_CHAR: return "signed char"; case T_TYPE_SHORT: return "short"; @@ -245,7 +245,7 @@ const char* GetBasicTypeName (const Type* T) default: return "signed integer"; } - } else if (IsSignUnsigned (T)) { + } else if (IsRawSignUnsigned (T)) { switch (GetRawType (T)) { case T_TYPE_CHAR: return "unsigned char"; case T_TYPE_SHORT: return "unsigned short"; diff --git a/src/cc65/datatype.h b/src/cc65/datatype.h index 7aa1d77be..660681909 100644 --- a/src/cc65/datatype.h +++ b/src/cc65/datatype.h @@ -652,6 +652,16 @@ INLINE TypeCode GetSignedness (const Type* T) # define GetSignedness(T) (GetUnderlyingTypeCode (T) & T_MASK_SIGN) #endif +#if defined(HAVE_INLINE) +INLINE int IsRawSignUnsigned (const Type* T) +/* Return true if this is an unsigned raw type */ +{ + return (GetRawSignedness (T) == T_SIGN_UNSIGNED); +} +#else +# define IsRawSignUnsigned(T) (GetRawSignedness (T) == T_SIGN_UNSIGNED) +#endif + #if defined(HAVE_INLINE) INLINE int IsSignUnsigned (const Type* T) /* Return true if this is an unsigned type */ @@ -662,6 +672,16 @@ INLINE int IsSignUnsigned (const Type* T) # define IsSignUnsigned(T) (GetSignedness (T) == T_SIGN_UNSIGNED) #endif +#if defined(HAVE_INLINE) +INLINE int IsRawSignSigned (const Type* T) +/* Return true if this is a signed raw type */ +{ + return (GetRawSignedness (T) == T_SIGN_SIGNED); +} +#else +# define IsRawSignSigned(T) (GetRawSignedness (T) == T_SIGN_SIGNED) +#endif + #if defined(HAVE_INLINE) INLINE int IsSignSigned (const Type* T) /* Return true if this is a signed type */ @@ -673,7 +693,7 @@ INLINE int IsSignSigned (const Type* T) #endif #if defined(HAVE_INLINE) -INLINE TypeCode GetRawSizeModifier(const Type* T) +INLINE TypeCode GetRawSizeModifier (const Type* T) /* Get the size modifier of a raw type */ { return (T->C & T_MASK_SIZE);