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 49 #if ULONG_MAX == 0xffffffffUL 51 #elif ULONG_MAX == 0xffffffffffffffffULL 54 #error "Unexpected max for unsigned long" 60 #define SIZEOF_LONG (LONG_BIT/CHAR_BIT) 65 #include <sys/types.h> 67 typedef long long int64;
68 #elif SIZEOF_LONG == 8 71 #error "Unexpected SIZEOF_LONG" 80 #ifndef BIT_SIZEOF_LONG 81 #define BIT_SIZEOF_LONG ((CHAR_BIT)*(SIZEOF_LONG)) 87 #if (SIZEOF_LONG == 8) 109 #define NULLp ((void*)NULL) 114 #define ABS(x) ((x)<0?(-(x)):(x)) 122 #if defined(__cplusplus) 123 static inline int si_max(
const int a,
const int b) {
return (a>b) ? a :
b; }
124 static inline int si_min(
const int a,
const int b) {
return (a<b) ? a :
b; }
125 static inline long si_max(
const long a,
const long b) {
return (a>b) ? a :
b; }
126 static inline unsigned long si_max(
const unsigned long a,
const unsigned long b) {
return (a>b) ? a :
b; }
127 static inline long si_min(
const long a,
const long b) {
return (a<b) ? a :
b; }
128 static inline unsigned long si_min(
const unsigned long a,
const unsigned long b) {
return (a<b) ? a :
b; }
130 #define si_max(A,B) ((A) > (B) ? (A) : (B)) 131 #define si_min(A,B) ((A) < (B) ? (A) : (B)) 286 #define OM_SING_KEEP 1000 320 # define FORCE_INLINE inline 323 #if defined(_MSC_VER) 324 # define FORCE_INLINE __forceinline 325 #elif defined(__GNUC__) && __GNUC__ > 3 326 # define FORCE_INLINE inline __attribute__ ((always_inline)) 328 # define FORCE_INLINE inline 331 # define FORCE_INLINE inline 338 #define DO_PRAGMA(x) _Pragma (#x) 339 #define TODO(who, msg) DO_PRAGMA(message ("TODO [for " #who "]: " #msg)) 343 #if defined(__GNUC__) && defined(__GNUC_MINOR__) 344 #define _GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) 346 #define _GNUC_PREREQ(maj, min) 0 349 #if _GNUC_PREREQ(3,3) && defined(__ELF__) 350 #define FORCE_INTERNAL __attribute__ ((visibility ("internal"))) 352 #define FORCE_INTERNAL 355 #if _GNUC_PREREQ(3,3) 356 #define FORCE_DEPRECATED __attribute__ ((deprecated)) 358 #define FORCE_DEPRECATED 362 # define BEGIN_CDECL extern "C" { 373 template<
typename A,
typename B>
389 return cast_A_to_B<A, void*>(
a);
396 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)