Add is_integral() to check for integral types (integer, short, enum).

This commit is contained in:
Bill Currie 2011-03-06 11:25:12 +09:00
parent 17a9dff769
commit 85bffbcad0
2 changed files with 9 additions and 2 deletions

View file

@ -146,6 +146,7 @@ void print_type (type_t *type);
const char *encode_params (type_t *type);
void encode_type (struct dstring_s *encoding, type_t *type);
int is_enum (type_t *type);
int is_integral (type_t *type);
int is_scalar (type_t *type);
int is_math (type_t *type);
int is_struct (type_t *type);

View file

@ -637,15 +637,21 @@ is_enum (type_t *type)
}
int
is_scalar (type_t *type)
is_integral (type_t *type)
{
etype_t t = type->type;
if (t == ev_float || t == ev_integer || t == ev_short)
if (t == ev_integer || t == ev_short)
return 1;
return is_enum (type);
}
int
is_scalar (type_t *type)
{
return type->type == ev_float || is_integral (type);
}
int
is_math (type_t *type)
{