Givaro 4.2.1
recdefine.h File Reference
#include <cstdlib>
#include <cstdint>
#include <type_traits>
#include "reclonglong.h"

Data Structures

struct  NBLIMB< K >
 
struct  NBLIMB< 6 >
 
struct  NBBITS< K >
 
struct  NBBITS< 6 >
 

Namespaces

namespace  RecInt
 NOTE : For this common file, either basic/reduc.h or mg/reduc.h has to be pre-included.
 

Macros

#define __RECINT_THRESHOLD_KARA   10
 
#define __RECINT_LIMB_BITS   64
 
#define __RECINT_LIMB_SIZE   6
 
#define __RECINT_MINUSONE   limb(0xffffffffffffffff)
 
#define __RECINT_MAXPOWTWO   limb(0x8000000000000000)
 
#define __RECINT_TYPENOTMAXPOWTWO(T)
 
#define __RECINT_THIRTYONEPOINTFIVE   3037000499u
 
#define __RECINT_IS_ARITH(T, ...)
 
#define __RECINT_IS_UNSIGNED(T, ...)
 
#define __RECINT_IS_SIGNED(T, ...)
 
#define __RECINT_IS_NOT_FUNDAMENTAL(T, ...)
 
#define __RECINT_DEBUG_LINE()
 
#define __RECINT_DEBUG_SHOW(X)
 
#define NO_ASM
 
#define W_TYPE_SIZE   64
 
#define recint__BITS4   (W_TYPE_SIZE / 4)
 
#define recint__ll_B   ((UWtype) 1 << (W_TYPE_SIZE / 2))
 
#define recint__ll_lowpart(t)
 
#define recint__ll_highpart(t)
 
#define recint__MPN(x)
 
#define recint_count_leading_zeros_gcc_clz(count, x)
 
#define recint_count_trailing_zeros_gcc_ctz(count, x)
 
#define __umulsidi3(u, v)
 
#define mpn_recint_umul_ppmm   recint__MPN(recint_umul_ppmm)
 
#define mpn_recint_umul_ppmm_r   recint__MPN(recint_umul_ppmm_r)
 
#define mpn_recint_udiv_qrnnd   recint__MPN(recint_udiv_qrnnd)
 
#define mpn_recint_udiv_qrnnd_r   recint__MPN(recint_udiv_qrnnd_r)
 
#define recint_add_ssaaaa(sh, sl, ah, al, bh, bl)
 
#define recint_sub_ddmmss(sh, sl, ah, al, bh, bl)
 
#define recint_umul_ppmm(w1, w0, u, v)
 
#define recint_smul_ppmm(w1, w0, u, v)
 
#define __recint_udiv_qrnnd_c(q, r, n1, n0, d)
 
#define UDIV_NEEDS_NORMALIZATION   1
 
#define recint_udiv_qrnnd   __recint_udiv_qrnnd_c
 
#define recint_count_leading_zeros(count, x)
 
#define RECINT_COUNT_LEADING_ZEROS_0   (W_TYPE_SIZE - 1)
 
#define RECINT_COUNT_LEADING_ZEROS_NEED_CLZ_TAB
 
#define RECINT_COUNT_LEADING_ZEROS_SLOW
 
#define recint_count_trailing_zeros(count, x)
 
#define UDIV_PREINV_ALWAYS   0
 
#define UMUL_TIME   1
 
#define UDIV_TIME   UMUL_TIME
 

Typedefs

typedef uint64_t limb
 
typedef uint64_t UWtype
 
typedef uint64_t UHWtype
 
typedef uint64_t UDWtype
 
typedef uint64_t UDItype
 
typedef uint32_t USItype
 
typedef int64_t DItype
 
typedef int32_t SItype
 

Functions

UWtype __recint_umul_ppmm (UWtype *, UWtype, UWtype)
 
UWtype __recint_umul_ppmm_r (UWtype, UWtype, UWtype *)
 
UWtype __recint_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype)
 
UWtype __recint_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *)
 

Variables

const unsigned char __clz_tab [129]
 

Macro Definition Documentation

◆ __RECINT_THRESHOLD_KARA

#define __RECINT_THRESHOLD_KARA   10

◆ __RECINT_LIMB_BITS

#define __RECINT_LIMB_BITS   64

◆ __RECINT_LIMB_SIZE

#define __RECINT_LIMB_SIZE   6

◆ __RECINT_MINUSONE

#define __RECINT_MINUSONE   limb(0xffffffffffffffff)

◆ __RECINT_MAXPOWTWO

#define __RECINT_MAXPOWTWO   limb(0x8000000000000000)

◆ __RECINT_TYPENOTMAXPOWTWO

#define __RECINT_TYPENOTMAXPOWTWO ( T)
Value:
~(T(1) << (8 * sizeof(T) - 1))

◆ __RECINT_THIRTYONEPOINTFIVE

#define __RECINT_THIRTYONEPOINTFIVE   3037000499u

◆ __RECINT_IS_ARITH

#define __RECINT_IS_ARITH ( T,
... )
Value:
typename std::enable_if<std::is_arithmetic<T>::value, __VA_ARGS__>::type

◆ __RECINT_IS_UNSIGNED

#define __RECINT_IS_UNSIGNED ( T,
... )
Value:
typename std::enable_if<std::is_unsigned<T>::value, __VA_ARGS__>::type

◆ __RECINT_IS_SIGNED

#define __RECINT_IS_SIGNED ( T,
... )
Value:
typename std::enable_if<std::is_signed<T>::value, __VA_ARGS__>::type

◆ __RECINT_IS_NOT_FUNDAMENTAL

#define __RECINT_IS_NOT_FUNDAMENTAL ( T,
... )
Value:
typename std::enable_if<!std::is_fundamental<T>::value, __VA_ARGS__>::type

◆ __RECINT_DEBUG_LINE

#define __RECINT_DEBUG_LINE ( )
Value:
std::cout << "------" << std::endl

◆ __RECINT_DEBUG_SHOW

#define __RECINT_DEBUG_SHOW ( X)
Value:
std::cout << std::hex << (X) << std::dec << std::endl

◆ NO_ASM

#define NO_ASM

◆ W_TYPE_SIZE

#define W_TYPE_SIZE   64

◆ recint__BITS4

#define recint__BITS4   (W_TYPE_SIZE / 4)

◆ recint__ll_B

#define recint__ll_B   ((UWtype) 1 << (W_TYPE_SIZE / 2))

◆ recint__ll_lowpart

#define recint__ll_lowpart ( t)
Value:
((UWtype) (t) & (recint__ll_B - 1))
#define recint__ll_B

◆ recint__ll_highpart

#define recint__ll_highpart ( t)
Value:
((UWtype) (t) >> (W_TYPE_SIZE / 2))
#define W_TYPE_SIZE
Definition recdefine.h:144

◆ recint__MPN

#define recint__MPN ( x)
Value:
__##x

◆ recint_count_leading_zeros_gcc_clz

#define recint_count_leading_zeros_gcc_clz ( count,
x )
Value:
do { \
(count) = __builtin_clzl (x); \
} while (0)

◆ recint_count_trailing_zeros_gcc_ctz

#define recint_count_trailing_zeros_gcc_ctz ( count,
x )
Value:
do { \
(count) = __builtin_ctzl (x); \
} while (0)

◆ __umulsidi3

#define __umulsidi3 ( u,
v )
Value:
({UWtype __hi, __lo; \
recint_umul_ppmm (__hi, __lo, u, v); \
((UDWtype) __hi << W_TYPE_SIZE) | __lo; })

◆ mpn_recint_umul_ppmm

#define mpn_recint_umul_ppmm   recint__MPN(recint_umul_ppmm)

◆ mpn_recint_umul_ppmm_r

#define mpn_recint_umul_ppmm_r   recint__MPN(recint_umul_ppmm_r)

◆ mpn_recint_udiv_qrnnd

#define mpn_recint_udiv_qrnnd   recint__MPN(recint_udiv_qrnnd)

◆ mpn_recint_udiv_qrnnd_r

#define mpn_recint_udiv_qrnnd_r   recint__MPN(recint_udiv_qrnnd_r)

◆ recint_add_ssaaaa

#define recint_add_ssaaaa ( sh,
sl,
ah,
al,
bh,
bl )
Value:
do { \
UWtype __x; \
__x = (al) + (bl); \
(sh) = (ah) + (bh) + (__x < (al)); \
(sl) = __x; \
} while (0)

◆ recint_sub_ddmmss

#define recint_sub_ddmmss ( sh,
sl,
ah,
al,
bh,
bl )
Value:
do { \
UWtype __x; \
__x = (al) - (bl); \
(sh) = (ah) - (bh) - ((al) < (bl)); \
(sl) = __x; \
} while (0)

◆ recint_umul_ppmm

#define recint_umul_ppmm ( w1,
w0,
u,
v )
Value:
do { \
UWtype __x0, __x1, __x2, __x3; \
UHWtype __ul, __vl, __uh, __vh; \
UWtype __u = (u), __v = (v); \
\
__ul = recint__ll_lowpart (__u); \
__uh = recint__ll_highpart (__u); \
__vl = recint__ll_lowpart (__v); \
__vh = recint__ll_highpart (__v); \
\
__x0 = (UWtype) __ul * __vl; \
__x1 = (UWtype) __ul * __vh; \
__x2 = (UWtype) __uh * __vl; \
__x3 = (UWtype) __uh * __vh; \
\
__x1 += recint__ll_highpart (__x0);/* this can't give carry */ \
__x1 += __x2; /* but this indeed can */ \
if (__x1 < __x2) /* did we get it? */ \
__x3 += recint__ll_B; /* yes, add it in the proper pos. */ \
\
(w1) = __x3 + recint__ll_highpart (__x1); \
(w0) = (__x1 << W_TYPE_SIZE/2) + recint__ll_lowpart (__x0); \
} while (0)
#define recint__ll_lowpart(t)
#define recint__ll_highpart(t)

◆ recint_smul_ppmm

#define recint_smul_ppmm ( w1,
w0,
u,
v )
Value:
do { \
UWtype __w1; \
UWtype __xm0 = (u), __xm1 = (v); \
recint_umul_ppmm (__w1, w0, __xm0, __xm1); \
(w1) = __w1 - (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \
- (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \
} while (0)

◆ __recint_udiv_qrnnd_c

#define __recint_udiv_qrnnd_c ( q,
r,
n1,
n0,
d )

◆ UDIV_NEEDS_NORMALIZATION

#define UDIV_NEEDS_NORMALIZATION   1

◆ recint_udiv_qrnnd

#define recint_udiv_qrnnd   __recint_udiv_qrnnd_c

◆ recint_count_leading_zeros

#define recint_count_leading_zeros ( count,
x )
Value:
do { \
UWtype __xr = (x); \
UWtype __a; \
\
if (W_TYPE_SIZE == 32) \
{ \
__a = __xr < ((UWtype) 1 << 2*recint__BITS4) \
? (__xr < ((UWtype) 1 << recint__BITS4) ? 1 : recint__BITS4 + 1) \
: (__xr < ((UWtype) 1 << 3*recint__BITS4) ? 2*recint__BITS4 + 1 \
: 3*recint__BITS4 + 1); \
} \
else \
{ \
for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \
if (((__xr >> __a) & 0xff) != 0) \
break; \
++__a; \
} \
\
(count) = W_TYPE_SIZE + 1 - __a - __clz_tab[__xr >> __a]; \
} while (0)
#define recint__BITS4
const unsigned char __clz_tab[129]

◆ RECINT_COUNT_LEADING_ZEROS_0

#define RECINT_COUNT_LEADING_ZEROS_0   (W_TYPE_SIZE - 1)

◆ RECINT_COUNT_LEADING_ZEROS_NEED_CLZ_TAB

#define RECINT_COUNT_LEADING_ZEROS_NEED_CLZ_TAB

◆ RECINT_COUNT_LEADING_ZEROS_SLOW

#define RECINT_COUNT_LEADING_ZEROS_SLOW

◆ recint_count_trailing_zeros

#define recint_count_trailing_zeros ( count,
x )
Value:
do { \
UWtype __ctz_x = (x); \
int __ctz_c; \
\
if (LIKELY ((__ctz_x & 0xff) != 0)) \
(count) = __clz_tab[__ctz_x & -__ctz_x] - 2; \
else \
{ \
for (__ctz_c = 8 - 2; __ctz_c < W_TYPE_SIZE - 2; __ctz_c += 8) \
{ \
__ctz_x >>= 8; \
if (LIKELY ((__ctz_x & 0xff) != 0)) \
break; \
} \
\
(count) = __ctz_c + __clz_tab[__ctz_x & -__ctz_x]; \
} \
} while (0)

◆ UDIV_PREINV_ALWAYS

#define UDIV_PREINV_ALWAYS   0

◆ UMUL_TIME

#define UMUL_TIME   1

◆ UDIV_TIME

#define UDIV_TIME   UMUL_TIME