mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-29 13:23:31 +02:00
Provide private G_SIGNEDNESS_OF macro in glib-private.h
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
committed by
Philip Withnall
parent
7c41a6529b
commit
a0ed94a11d
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "girnode-private.h"
|
||||
#include "gitypelib-internal.h"
|
||||
#include "glib-private.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -451,23 +452,13 @@ 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);
|
||||
|
||||
static IntegerAliasInfo integer_aliases[] = {
|
||||
/* It is platform-dependent whether gchar is signed or unsigned, but
|
||||
* GObject-Introspection has traditionally treated it as signed,
|
||||
* so continue to hard-code that instead of using INTEGER_ALIAS */
|
||||
{ "gchar", sizeof (gchar), 1 },
|
||||
|
||||
#define INTEGER_ALIAS(T) { #T, sizeof (T), signedness (T) }
|
||||
#define INTEGER_ALIAS(T) { #T, sizeof (T), G_SIGNEDNESS_OF (T) }
|
||||
INTEGER_ALIAS (guchar),
|
||||
INTEGER_ALIAS (gshort),
|
||||
INTEGER_ALIAS (gushort),
|
||||
|
Reference in New Issue
Block a user