girparser: Add a pseudo-doc-comment for signedness()

We could consider adding this to gmacros if it's useful anywhere else.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-03-18 10:46:13 +00:00
parent c7e0f3e6b8
commit d9ee53d0eb

View File

@ -454,6 +454,12 @@ typedef struct {
unsigned int is_signed : 1;
} IntegerAliasInfo;
/*
* signedness:
* @T: a numeric type
*
* Returns: 1 if @T is signed, 0 if it is unsigned
*/
#define signedness(T) (((T) -1) <= 0)
G_STATIC_ASSERT (signedness (int) == 1);
G_STATIC_ASSERT (signedness (unsigned int) == 0);