1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 05:29:30 +00:00

Utility to check for castability.

This commit is contained in:
acqn 2020-08-02 21:51:32 +08:00 committed by Oliver Schmidt
parent 52051f444e
commit d841bbe498
2 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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 */