diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index d1c34c825..cffec7880 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -1018,6 +1018,22 @@ Type* ArrayToPtr (Type* T) +int IsClassArithmetic (const Type* T) +/* Return true if this is an arithmetic type */ +{ + return IsClassInt (T) || IsClassFloat (T); +} + + + +int IsCastType (const Type* T) +/* Return true if this type can be used for casting */ +{ + return IsClassArithmetic (T) || IsClassPtr (T) || IsTypeVoid (T); +} + + + int IsVariadicFunc (const Type* T) /* Return true if this is a function type or pointer to function type with ** variable parameter list diff --git a/src/cc65/datatype.h b/src/cc65/datatype.h index ad382d50f..66f1b8b05 100644 --- a/src/cc65/datatype.h +++ b/src/cc65/datatype.h @@ -578,6 +578,12 @@ INLINE int IsClassFunc (const Type* T) # define IsClassFunc(T) (GetClass (T) == T_CLASS_FUNC) #endif +int IsClassArithmetic (const Type* T); +/* Return true if this is an arithmetic type */ + +int IsCastType (const Type* T); +/* Return true if this type can be used for casting */ + #if defined(HAVE_INLINE) INLINE TypeCode GetRawSignedness (const Type* T) /* Get the raw signedness of a type */