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))
108#define NULLp ((void*)NULL)
114 int const mask =
v >> (
sizeof(int) *
CHAR_BIT - 1);
115 return ((
v + mask) ^ mask);
123#if defined(__cplusplus)
124static inline int si_max(
const int a,
const int b) {
return (a>
b) ? a :
b; }
125static inline int si_min(
const int a,
const int b) {
return (a<
b) ? a :
b; }
126static inline long si_max(
const long a,
const long b) {
return (a>
b) ? a :
b; }
127static inline unsigned long si_max(
const unsigned long a,
const unsigned long b) {
return (a>
b) ? a :
b; }
128static inline long si_min(
const long a,
const long b) {
return (a<
b) ? a :
b; }
129static inline unsigned long si_min(
const unsigned long a,
const unsigned long b) {
return (a<
b) ? a :
b; }
131#define si_max(A,B) ((A) > (B) ? (A) : (B))
132#define si_min(A,B) ((A) < (B) ? (A) : (B))
284#define OM_SING_KEEP 1000
318# define FORCE_INLINE inline
322# define FORCE_INLINE __forceinline
323#elif defined(__GNUC__) && __GNUC__ > 3
324# define FORCE_INLINE inline __attribute__ ((always_inline))
326# define FORCE_INLINE inline
329# define FORCE_INLINE inline
336#define DO_PRAGMA(x) _Pragma (#x)
337#define TODO(who, msg) DO_PRAGMA(message ("TODO [for " #who "]: " #msg))
341#if defined(__GNUC__) && defined(__GNUC_MINOR__)
342#define _GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
344#define _GNUC_PREREQ(maj, min) 0
347#if _GNUC_PREREQ(3,3) && defined(__ELF__)
348#define FORCE_INTERNAL __attribute__ ((visibility ("internal")))
350#define FORCE_INTERNAL
354#define FORCE_DEPRECATED __attribute__ ((deprecated))
356#define FORCE_DEPRECATED
360# define BEGIN_CDECL extern "C" {
371template<
typename A,
typename B>
387 return cast_A_to_B<A, void*>(a);
394 return cast_A_to_B<void*, A>(
p);
400#define LIKELY(X) (__builtin_expect(!!(X), 1))
401#define UNLIKELY(X) (__builtin_expect(!!(X), 0))
404#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