mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-06 17:32:05 +00:00
[qfcc] Add is_signed and is_unsigned type check functions
Makes implementing casts for spir-v much easier.
This commit is contained in:
parent
d6d44b62d9
commit
81cc736683
2 changed files with 24 additions and 5 deletions
|
@ -233,6 +233,8 @@ bool is_pointer (const type_t *type) __attribute__((pure));
|
|||
bool is_reference (const type_t *type) __attribute__((pure));
|
||||
bool is_enum (const type_t *type) __attribute__((pure));
|
||||
bool is_bool (const type_t *type) __attribute__((pure));
|
||||
bool is_signed (const type_t *type) __attribute__((pure));
|
||||
bool is_unsigned (const type_t *type) __attribute__((pure));
|
||||
bool is_integral (const type_t *type) __attribute__((pure));
|
||||
bool is_real (const type_t *type) __attribute__((pure));
|
||||
bool is_scalar (const type_t *type) __attribute__((pure));
|
||||
|
|
|
@ -1380,13 +1380,30 @@ is_bool (const type_t *type)
|
|||
}
|
||||
|
||||
bool
|
||||
is_integral (const type_t *type)
|
||||
is_signed (const type_t *type)
|
||||
{
|
||||
type = unalias_type (type);
|
||||
if (is_int (type) || is_uint (type) || is_short (type))
|
||||
return 1;
|
||||
if (is_long (type) || is_ulong (type) || is_ushort (type))
|
||||
return 1;
|
||||
if (is_int (type) || is_long (type) || is_short (type)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
is_unsigned (const type_t *type)
|
||||
{
|
||||
type = unalias_type (type);
|
||||
if (is_uint (type) || is_ulong (type) || is_ushort (type)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
is_integral (const type_t *type)
|
||||
{
|
||||
if (is_signed (type) || is_unsigned (type))
|
||||
return true;
|
||||
return is_enum (type);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue