From 85bffbcad099d4157a5f61e7ebf95b91456e540b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 6 Mar 2011 11:25:12 +0900 Subject: [PATCH] Add is_integral() to check for integral types (integer, short, enum). --- tools/qfcc/include/type.h | 1 + tools/qfcc/source/type.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/qfcc/include/type.h b/tools/qfcc/include/type.h index dd0d7a430..f4eaf755d 100644 --- a/tools/qfcc/include/type.h +++ b/tools/qfcc/include/type.h @@ -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); diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index b4a4a72af..0c0eeac0a 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -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) {