bool is_type_integer(const type_t *type) { assert(!is_typeref(type)); if (!is_type_arithmetic(type)) return false; return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_INTEGER); }
bool is_type_signed(const type_t *type) { assert(!is_typeref(type)); if (!is_type_arithmetic(type)) return false; return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_SIGNED); }
bool is_type_float(const type_t *type) { assert(!is_typeref(type)); if (type->kind != TYPE_ATOMIC) return false; return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_FLOAT); }
bool is_type_complex(const type_t *type) { assert(!is_typeref(type)); if (type->kind != TYPE_ATOMIC) return false; return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_COMPLEX); }
bool is_type_integer(const type_t *type) { assert(!is_typeref(type)); if (type->kind == TYPE_ENUM) return true; if (type->kind != TYPE_ATOMIC) return false; return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_INTEGER); }
bool is_type_signed(const type_t *type) { assert(!is_typeref(type)); /* enum types are int for now */ if (type->kind == TYPE_ENUM) return true; if (type->kind != TYPE_ATOMIC) return false; return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_SIGNED); }
bool is_type_arithmetic(const type_t *type) { assert(!is_typeref(type)); switch(type->kind) { case TYPE_ENUM: return true; case TYPE_ATOMIC: case TYPE_COMPLEX: case TYPE_IMAGINARY: return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_ARITHMETIC); default: return false; } }