X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=internals%2F_PDCLIB_aux.h;h=ebbced4abc8658b3c312b2d4b7b5a984ecfb65ef;hp=d09c9e7355b1bbfce6156fa650fe9c2779508dec;hb=7e1986c10dea181d5a096b6c6de78ab23dabcb95;hpb=b0ae5d16c993045fd9ec5e7866962164bf9934fd diff --git a/internals/_PDCLIB_aux.h b/internals/_PDCLIB_aux.h index d09c9e7..ebbced4 100644 --- a/internals/_PDCLIB_aux.h +++ b/internals/_PDCLIB_aux.h @@ -47,6 +47,9 @@ /* _PDCLIB_concat( x, y ) concatenates two preprocessor tokens with extending */ /* _PDCLIB_static_assert( e, m ) does a compile-time assertion of expression */ /* e, with m as the failure message. */ +/* _PDCLIB_TYPE_SIGNED( type ) resolves to true if type is signed. */ +/* _PDCLIB_TWOS_COMPLEMENT( type ) resolves to true if two's complement is */ +/* used for type. */ /* -------------------------------------------------------------------------- */ #define _PDCLIB_cc( x, y ) x ## y @@ -54,6 +57,9 @@ #define _PDCLIB_static_assert( e, m ) enum { _PDCLIB_concat( _PDCLIB_assert_, __LINE__ ) = 1 / ( !!(e) ) } +#define _PDCLIB_TYPE_SIGNED( type ) (((type) -1) < 0) +#define _PDCLIB_TWOS_COMPLEMENT( type ) ((type) ~ (type) 0 < 0 ) + #define _PDCLIB_symbol2value( x ) #x #define _PDCLIB_symbol2string( x ) _PDCLIB_symbol2value( x )