16#ifndef MISC_AUXILIARY_H
17#define MISC_AUXILIARY_H
20#include "libpolysconfig.h"
34#define SI_INTEGER_VARIANT 2
38#define SI_BIGINT_VARIANT 1
48#if ULONG_MAX == 0xffffffffUL
50#elif ULONG_MAX == 0xffffffffffffffffULL
53#error "Unexpected max for unsigned long"
59#define SIZEOF_LONG (LONG_BIT/CHAR_BIT)
66typedef long long int64;
70#error "Unexpected SIZEOF_LONG"
79#ifndef BIT_SIZEOF_LONG
80#define BIT_SIZEOF_LONG ((CHAR_BIT)*(SIZEOF_LONG))
85#define BITSET unsigned int
109#define NULLp ((void*)NULL)
115 int const mask =
v >> (
sizeof(int) *
CHAR_BIT - 1);
116 return ((
v + mask) ^ mask);
124#if defined(__cplusplus)
125static inline int si_max(
const int a,
const int b) {
return (a>
b) ? a :
b; }
126static inline int si_min(
const int a,
const int b) {
return (a<
b) ? a :
b; }
127static inline long si_max(
const long a,
const long b) {
return (a>
b) ? a :
b; }
128static inline unsigned long si_max(
const unsigned long a,
const unsigned long b) {
return (a>
b) ? a :
b; }
129static inline long si_min(
const long a,
const long b) {
return (a<
b) ? a :
b; }
130static inline unsigned long si_min(
const unsigned long a,
const unsigned long b) {
return (a<
b) ? a :
b; }
132#define si_max(A,B) ((A) > (B) ? (A) : (B))
133#define si_min(A,B) ((A) < (B) ? (A) : (B))
285#define OM_SING_KEEP 1000
319# define FORCE_INLINE inline
323# define FORCE_INLINE __forceinline
324#elif defined(__GNUC__) && __GNUC__ > 3
325# define FORCE_INLINE inline __attribute__ ((always_inline))
327# define FORCE_INLINE inline
330# define FORCE_INLINE inline
337#define DO_PRAGMA(x) _Pragma (#x)
338#define TODO(who, msg) DO_PRAGMA(message ("TODO [for " #who "]: " #msg))
342#if defined(__GNUC__) && defined(__GNUC_MINOR__)
343#define _GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
345#define _GNUC_PREREQ(maj, min) 0
348#if _GNUC_PREREQ(3,3) && defined(__ELF__)
349#define FORCE_INTERNAL __attribute__ ((visibility ("internal")))
351#define FORCE_INTERNAL
355#define FORCE_DEPRECATED __attribute__ ((deprecated))
357#define FORCE_DEPRECATED
361# define BEGIN_CDECL extern "C" {
372template<
typename A,
typename B>
401#define LIKELY(X) (__builtin_expect(!!(X), 1))
402#define UNLIKELY(X) (__builtin_expect(!!(X), 0))
405#define UNLIKELY(X) (X)
static int si_max(const int a, const int b)
void * cast_A_to_vptr(A a)
A cast_vptr_to_A(void *p)
static int si_min(const int a, const int b)
const Variable & v
< [in] a sqrfree bivariate poly