My Project  debian-1:4.1.2-p1+ds-2
Macros | Typedefs | Functions
auxiliary.h File Reference

All the auxiliary stuff. More...

#include "libpolysconfig.h"
#include "factory/globaldefs.h"
#include <sys/types.h>

Go to the source code of this file.

Macros

#define SI_INTEGER_VARIANT   2
 
#define SI_BIGINT_VARIANT   1
 
#define CHAR_BIT   (8)
 
#define BIT_SIZEOF_LONG   ((CHAR_BIT)*(SIZEOF_LONG))
 
#define FALSE   0
 
#define TRUE   1
 
#define NULL   (0)
 
#define NULLp   ((void*)NULL)
 
#define loop   for(;;)
 
#define SSI_BASE   16
 
#define NO_INLINE
 
#define PDEBUG   0
 
#define KDEBUG   0
 
#define LDEBUG
 
#define RDEBUG
 
#define TEST
 
#define YYDEBUG   1
 
#define FORCE_INLINE   inline
 
#define DO_PRAGMA(x)   _Pragma (#x)
 
#define TODO(who, msg)   DO_PRAGMA(message ("TODO [for " #who "]: " #msg))
 
#define _GNUC_PREREQ(maj, min)   0
 
#define FORCE_INTERNAL
 
#define FORCE_DEPRECATED
 
#define BEGIN_CDECL   extern "C" {
 
#define END_CDECL   }
 
#define LIKELY(X)   (X)
 
#define UNLIKELY(X)   (X)
 

Typedefs

typedef long int64
 
typedef int BOOLEAN
 
typedef void * ADDRESS
 

Functions

static int ABS (int v)
 
static int SI_LOG2 (int v)
 
static int si_max (const int a, const int b)
 
static int si_min (const int a, const int b)
 
static long si_max (const long a, const long b)
 
static unsigned long si_max (const unsigned long a, const unsigned long b)
 
static long si_min (const long a, const long b)
 
static unsigned long si_min (const unsigned long a, const unsigned long b)
 
template<typename A , typename B >
B cast_A_to_B (A a)
 
template<typename A >
void * cast_A_to_vptr (A a)
 
template<typename A >
A cast_vptr_to_A (void *p)
 

Detailed Description

All the auxiliary stuff.

ABSTRACT: we shall put here everything that does not have its own place.

Author
Oleksandr Motsak

Definition in file auxiliary.h.

Macro Definition Documentation

◆ _GNUC_PREREQ

#define _GNUC_PREREQ (   maj,
  min 
)    0

Definition at line 360 of file auxiliary.h.

◆ BEGIN_CDECL

#define BEGIN_CDECL   extern "C" {

Definition at line 376 of file auxiliary.h.

◆ BIT_SIZEOF_LONG

#define BIT_SIZEOF_LONG   ((CHAR_BIT)*(SIZEOF_LONG))

Definition at line 80 of file auxiliary.h.

◆ CHAR_BIT

#define CHAR_BIT   (8)

Definition at line 75 of file auxiliary.h.

◆ DO_PRAGMA

#define DO_PRAGMA (   x)    _Pragma (#x)

Definition at line 352 of file auxiliary.h.

◆ END_CDECL

#define END_CDECL   }

Definition at line 377 of file auxiliary.h.

◆ FALSE

#define FALSE   0

Definition at line 96 of file auxiliary.h.

◆ FORCE_DEPRECATED

#define FORCE_DEPRECATED

Definition at line 372 of file auxiliary.h.

◆ FORCE_INLINE

#define FORCE_INLINE   inline

Definition at line 345 of file auxiliary.h.

◆ FORCE_INTERNAL

#define FORCE_INTERNAL

Definition at line 366 of file auxiliary.h.

◆ KDEBUG

#define KDEBUG   0

Definition at line 314 of file auxiliary.h.

◆ LDEBUG

#define LDEBUG

Definition at line 317 of file auxiliary.h.

◆ LIKELY

#define LIKELY (   X)    (X)

Definition at line 419 of file auxiliary.h.

◆ loop

#define loop   for(;;)

Definition at line 137 of file auxiliary.h.

◆ NO_INLINE

#define NO_INLINE

Definition at line 163 of file auxiliary.h.

◆ NULL

#define NULL   (0)

Definition at line 104 of file auxiliary.h.

◆ NULLp

#define NULLp   ((void*)NULL)

Definition at line 108 of file auxiliary.h.

◆ PDEBUG

#define PDEBUG   0

Definition at line 186 of file auxiliary.h.

◆ RDEBUG

#define RDEBUG

Definition at line 320 of file auxiliary.h.

◆ SI_BIGINT_VARIANT

#define SI_BIGINT_VARIANT   1

Definition at line 38 of file auxiliary.h.

◆ SI_INTEGER_VARIANT

#define SI_INTEGER_VARIANT   2

Definition at line 34 of file auxiliary.h.

◆ SSI_BASE

#define SSI_BASE   16

Definition at line 151 of file auxiliary.h.

◆ TEST

#define TEST

Definition at line 323 of file auxiliary.h.

◆ TODO

#define TODO (   who,
  msg 
)    DO_PRAGMA(message ("TODO [for " #who "]: " #msg))

Definition at line 353 of file auxiliary.h.

◆ TRUE

#define TRUE   1

Definition at line 100 of file auxiliary.h.

◆ UNLIKELY

#define UNLIKELY (   X)    (X)

Definition at line 420 of file auxiliary.h.

◆ YYDEBUG

#define YYDEBUG   1

Definition at line 326 of file auxiliary.h.

Typedef Documentation

◆ ADDRESS

typedef void* ADDRESS

Definition at line 135 of file auxiliary.h.

◆ BOOLEAN

typedef int BOOLEAN

Definition at line 87 of file auxiliary.h.

◆ int64

typedef long int64

Definition at line 68 of file auxiliary.h.

Function Documentation

◆ ABS()

static int ABS ( int  v)
inlinestatic

Definition at line 112 of file auxiliary.h.

113 {
114  int const mask = v >> (sizeof(int) * CHAR_BIT - 1);
115  return ((v + mask) ^ mask);
116 }
#define CHAR_BIT
Definition: auxiliary.h:75
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37

◆ cast_A_to_B()

template<typename A , typename B >
B cast_A_to_B ( A  a)
inline

Definition at line 388 of file auxiliary.h.

389 {
390  union
391  {
392  A a;
393  B b;
394  } u;
395 
396  u.a = a;
397  return u.b;
398 }
CanonicalForm b
Definition: cfModGcd.cc:4044
b *CanonicalForm B
Definition: facBivar.cc:52
#define A
Definition: sirandom.c:24

◆ cast_A_to_vptr()

template<typename A >
void* cast_A_to_vptr ( A  a)
inline

Definition at line 401 of file auxiliary.h.

402 {
403  return cast_A_to_B<A, void*>(a);
404 }

◆ cast_vptr_to_A()

template<typename A >
A cast_vptr_to_A ( void *  p)
inline

Definition at line 408 of file auxiliary.h.

409 {
410  return cast_A_to_B<void*, A>(p);
411 }
int p
Definition: cfModGcd.cc:4019

◆ SI_LOG2()

static int SI_LOG2 ( int  v)
inlinestatic

Definition at line 121 of file auxiliary.h.

122 {
123  const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
124  const unsigned int S[] = {1, 2, 4, 8, 16};
125 
126  unsigned int r = 0; // result of log2(v) will go here
127  if (v & b[4]) { v >>= S[4]; r |= S[4]; }
128  if (v & b[3]) { v >>= S[3]; r |= S[3]; }
129  if (v & b[2]) { v >>= S[2]; r |= S[2]; }
130  if (v & b[1]) { v >>= S[1]; r |= S[1]; }
131  if (v & b[0]) { v >>= S[0]; r |= S[0]; }
132  return (int)r;
133 }

◆ si_max() [1/3]

static int si_max ( const int  a,
const int  b 
)
inlinestatic

Definition at line 140 of file auxiliary.h.

140 { return (a>b) ? a : b; }

◆ si_max() [2/3]

static long si_max ( const long  a,
const long  b 
)
inlinestatic

Definition at line 142 of file auxiliary.h.

142 { return (a>b) ? a : b; }

◆ si_max() [3/3]

static unsigned long si_max ( const unsigned long  a,
const unsigned long  b 
)
inlinestatic

Definition at line 143 of file auxiliary.h.

143 { return (a>b) ? a : b; }

◆ si_min() [1/3]

static int si_min ( const int  a,
const int  b 
)
inlinestatic

Definition at line 141 of file auxiliary.h.

141 { return (a<b) ? a : b; }

◆ si_min() [2/3]

static long si_min ( const long  a,
const long  b 
)
inlinestatic

Definition at line 144 of file auxiliary.h.

144 { return (a<b) ? a : b; }

◆ si_min() [3/3]

static unsigned long si_min ( const unsigned long  a,
const unsigned long  b 
)
inlinestatic

Definition at line 145 of file auxiliary.h.

145 { return (a<b) ? a : b; }