From a8afef4d4376cbc221cbdd00ae8729e71be96a4e Mon Sep 17 00:00:00 2001 From: Siddhi Tadpatrikar Date: Fri, 11 Feb 2011 19:18:53 -0500 Subject: [PATCH] Added API functions for checking types of signed and unsigned ints --- src/aop-type.c | 19 +++++++++++++++++++ src/aop.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/aop-type.c b/src/aop-type.c index c9d2194..f88a670 100644 --- a/src/aop-type.c +++ b/src/aop-type.c @@ -730,6 +730,25 @@ is_all_integer_type (const struct aop_type *type) && type->pointer_levels == 0 && type->size <= 0); } +/* Returns true if the specified type is a "signed integer" which is + NOT 128 bits integer */ +int +aop_is_all_signed_subtype (const struct aop_type *type) +{ + return (type->kind == ATK_SIGNED_INT + && type->pointer_levels == 0 && type->size <= 8); +} + +/* Returns true if the specified type is a "unsigned integer" which is + NOT 128 bits integer */ +int +aop_is_all_unsigned_subtype (const struct aop_type *type) +{ + return (type->kind == ATK_UNSIGNED_INT + && type->pointer_levels == 0 && type->size <= 8); +} + + /* Returns true if specified type is an "all fp" type. */ bool is_all_fp_type (const struct aop_type *type) diff --git a/src/aop.h b/src/aop.h index 55ef370..a0d1549 100644 --- a/src/aop.h +++ b/src/aop.h @@ -209,6 +209,8 @@ extern const struct aop_type *aop_t_enum (const char *tag); extern const struct aop_type *aop_t_pointer_to (const struct aop_type *type); extern int aop_is_pointer_type (const struct aop_type *type); +extern int aop_is_all_signed_integer_type (const struct aop_type *type); +extern int aop_is_all_unsigned_integer_type (const struct aop_type *type); extern void aop_cast_to_all_pointer (struct aop_dynval *dv); extern const struct aop_type *aop_get_dynval_type (struct aop_dynval *dv); -- 2.34.1