Add is_float ().

For now, it checks just floats, but I might one day add doubles.
This commit is contained in:
Bill Currie 2011-03-06 11:28:54 +09:00
parent 85bffbcad0
commit fe4df03896
2 changed files with 8 additions and 1 deletions

View file

@ -147,6 +147,7 @@ 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_float (type_t *type);
int is_scalar (type_t *type);
int is_math (type_t *type);
int is_struct (type_t *type);

View file

@ -646,10 +646,16 @@ is_integral (type_t *type)
return is_enum (type);
}
int
is_float (type_t *type)
{
return type->type == ev_float;
}
int
is_scalar (type_t *type)
{
return type->type == ev_float || is_integral (type);
return is_float (type) || is_integral (type);
}
int