16 #ifndef MISC_AUXILIARY_H 17 #define MISC_AUXILIARY_H 20 #include "libpolysconfig.h" 32 #define SI_INTEGER_VARIANT 2 36 #define SI_BIGINT_VARIANT 1 46 #if ULONG_MAX == 0xffffffffUL 48 #elif ULONG_MAX == 0xffffffffffffffffULL 51 #error "Unexpected max for unsigned long" 57 #define SIZEOF_LONG (LONG_BIT/CHAR_BIT) 62 #include <sys/types.h> 64 typedef long long int64;
65 #elif SIZEOF_LONG == 8 68 #error "Unexpected SIZEOF_LONG" 77 #ifndef BIT_SIZEOF_LONG 78 #define BIT_SIZEOF_LONG ((CHAR_BIT)*(SIZEOF_LONG)) 84 #if (SIZEOF_LONG == 8) 106 #define NULLp ((void*)NULL) 111 #define ABS(x) ((x)<0?(-(x)):(x)) 119 #if defined(__cplusplus) 120 static inline int si_max(
const int a,
const int b) {
return (a>b) ? a :
b; }
121 static inline int si_min(
const int a,
const int b) {
return (a<b) ? a :
b; }
122 static inline long si_max(
const long a,
const long b) {
return (a>b) ? a :
b; }
123 static inline unsigned long si_max(
const unsigned long a,
const unsigned long b) {
return (a>b) ? a :
b; }
124 static inline long si_min(
const long a,
const long b) {
return (a<b) ? a :
b; }
125 static inline unsigned long si_min(
const unsigned long a,
const unsigned long b) {
return (a<b) ? a :
b; }
127 #define si_max(A,B) ((A) > (B) ? (A) : (B)) 128 #define si_min(A,B) ((A) < (B) ? (A) : (B)) 283 #define OM_SING_KEEP 1000 317 # define FORCE_INLINE inline 320 #if defined(_MSC_VER) 321 # define FORCE_INLINE __forceinline 322 #elif defined(__GNUC__) && __GNUC__ > 3 323 # define FORCE_INLINE inline __attribute__ ((always_inline)) 325 # define FORCE_INLINE inline 328 # define FORCE_INLINE inline 335 #define DO_PRAGMA(x) _Pragma (#x) 336 #define TODO(who, msg) DO_PRAGMA(message ("TODO [for " #who "]: " #msg)) 340 #if defined(__GNUC__) && defined(__GNUC_MINOR__) 341 #define _GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) 343 #define _GNUC_PREREQ(maj, min) 0 346 #if _GNUC_PREREQ(3,3) && defined(__ELF__) 347 #define FORCE_INTERNAL __attribute__ ((visibility ("internal"))) 349 #define FORCE_INTERNAL 352 #if _GNUC_PREREQ(3,3) 353 #define FORCE_DEPRECATED __attribute__ ((deprecated)) 355 #define FORCE_DEPRECATED 359 # define BEGIN_CDECL extern "C" { 370 template<
typename A,
typename B>
386 return cast_A_to_B<A, void*>(
a);
393 return cast_A_to_B<void*, A>(
p);
static int si_min(const int a, const int b)
A cast_vptr_to_A(void *p)
static int si_max(const int a, const int b)
void * cast_A_to_vptr(A a)