?? flint.h
字號:
/* Read flint.h only once */
#ifndef __FLINTH__
#define __FLINTH__
/* Turn FLINT secure mode on */
#if !(defined FLINT_SECURE || defined FLINT_UNSECURE)
#define FLINT_SECURE
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
/******************************************************************************/
/* Macros */
/******************************************************************************/
/* Simple makros */
/* Errorcodes */
#define E_CLINT_OK 0 /* Everything O.K. */
#define E_CLINT_DBZ -1 /* Division by zero */
#define E_CLINT_OFL -2 /* Overflow */
#define E_CLINT_UFL -3 /* Underflow */
#define E_CLINT_MAL -4 /* Error in memory allocation */
#define E_CLINT_NOR -5 /* Register not present */
#define E_CLINT_BOR -6 /* Base in str2clint_l() not valid */
#define E_CLINT_MOD -7 /* Modulus even in ?mexp?m_l() */
#define E_CLINT_NPT -8 /* Null-Pointer received */
#define E_VCHECK_OK 0 /* CLINT-format O.K. */
#define E_VCHECK_LDZ 1 /* vcheck_l-Warning: Leading zeros */
#define E_VCHECK_MEM -1 /* vcheck_l-Error: Null-Pointer */
#define E_VCHECK_OFL -2 /* vcheck_l-Error: Overflow */
/**************************************************************/
/* Constants referring to the internal CLINT-representation */
/**************************************************************/
#define BASE 0x10000UL
#define BASEMINONE 0xffffU
#define BASEMINONEL 0xffffUL
#define DBASEMINONE 0xffffffffUL
#define BASEDIV2 0x8000U
#define DBASEDIV2 0x80000000U
#define BITPERDGT 16UL
#define LDBITPERDGT 4U
/*******************************************************/
/* Number of digits of CLINT-ojects to base 0x10000 */
#define CLINTMAXDIGIT 256U
/*******************************************************/
#define CLINTMAXSHORT (CLINTMAXDIGIT + 1)
#define CLINTMAXLONG ((CLINTMAXDIGIT >> 1) + 1)
#define CLINTMAXBYTE (CLINTMAXSHORT << 1)
#define CLINTMAXBIT (CLINTMAXDIGIT << 4)
/* Number of small prime numbers stored in smallprimes[] */
#define NOOFSMALLPRIMES 6542
/* Default number of registers in register bank */
#define NOOFREGS 16U
/* FLINT/C-Version */
#define FLINT_VERMAJ 2 /* Major-Version */
#define FLINT_VERMIN 3 /* Minor-Version */
/* FLINT/C-Version as USHORT-value 0xhhll, hh=FLINT_VERMAJ, ll=FLINT_VERMIN */
#define FLINT_VERSION ((FLINT_VERMAJ << 8) + FLINT_VERMIN)
#ifdef FLINT_COMPATIBILITY
/* Macros for Compatibility with version 1.xx */
#define E_OK 0 /* Everything O.K. */
#define E_DBZ -1 /* Division by zero */
#define E_OFL -2 /* Overflow */
#define E_UFL -3 /* Underflow */
#define E_MAL -4 /* Error in memory allocation */
#define E_NOR -5 /* Register not present */
#define E_BOR -6 /* Base in str2clint_l() not valid */
#define E_MOD -7 /* Modulus even in ?mexp?m_l() */
#define E_NPT -8 /* Null-Pointer received */
#endif /* FLINT_COMPATIBILITY */
/* Internationalization
#define ggT_l gcd_l
#define xggT_l xgcd_l
#define kgV_l lcm_l
#define zweiantei_l twofact_l
#define chinrest_l chinrem_l
#define primwurz_l primroot_l
*/
/* LINT_ASM -> FLINT_ASM, LINT_ANSI -> FLINT_ANSI */
#ifdef LINT_ASM
#ifndef FLINT_ASM
#define FLINT_ASM
#endif /* !FLINT_ASM */
#endif /* LINT_ASM */
#ifdef LINT_ANSI
#ifndef FLINT_ANSI
#define FLINT_ANSI
#endif /* !LINT_ANSI */
#endif /* LINT_ANSI */
#ifdef FLINT_ASM
#define _FLINT_ASM 0x61 /* ASCII 'a': Symbol for */
#else /* Assembler-support */
#define _FLINT_ASM 0
#endif
#ifdef FLINT_SECURE
#define _FLINT_SECMOD 0x73 /* ASCII 's': Symbol for */
#else /* security-mode, in which */
#define _FLINT_SECMOD 0 /* all CLINT-Variables will */
#endif /* be purged after use */
/* Makros with parameters */
/* Definition of standard-CLINT-Registers */
#define r0_l get_reg_l(0)
#define r1_l get_reg_l(1)
#define r2_l get_reg_l(2)
#define r3_l get_reg_l(3)
#define r4_l get_reg_l(4)
#define r5_l get_reg_l(5)
#define r6_l get_reg_l(6)
#define r7_l get_reg_l(7)
#define r8_l get_reg_l(8)
#define r9_l get_reg_l(9)
#define r10_l get_reg_l(10)
#define r11_l get_reg_l(11)
#define r12_l get_reg_l(12)
#define r13_l get_reg_l(13)
#define r14_l get_reg_l(14)
#define r15_l get_reg_l(15)
/* MIN, MAX etc. */
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
#define MIN_L(a,b) (lt_l ((a), (b)) ? (a) : (b))
#define min_l(a,b) (lt_l ((a), (b)) ? (a) : (b))
#define MAX_L(a,b) (gt_l ((a), (b)) ? (a) : (b))
#define max_l(a,b) (gt_l ((a), (b)) ? (a) : (b))
#ifndef SWAP
#define SWAP(a,b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#endif
#ifndef swap
#define swap(a,b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#endif
#define SWAP_L(a,b) (xor_l((a),(b),(a)),xor_l((b),(a),(b)),xor_l((a),(b),(a)))
#define swap_l(a,b) (xor_l((a),(b),(a)),xor_l((b),(a),(b)),xor_l((a),(b),(a)))
/* ReMoveLeaDingZeRoS from CLINT-variables */
#define RMLDZRS_L(n_l) \
while ((DIGITS_L (n_l) > 0) && (*MSDPTR_L (n_l) == 0)) {DECDIGITS_L (n_l);}
#define rmldzrs_l(n_l) \
while ((DIGITS_L (n_l) > 0) && (*MSDPTR_L (n_l) == 0)) {DECDIGITS_L (n_l);}
/* Copy CLINT types with removal of leading zeros */
#define ZCPY_L(dest_l,src_l)\
cpy_l ((dest_l), (src_l));\
RMLDZRS_L ((dest_l))
#define zcpy_l(dest_l,src_l)\
cpy_l ((dest_l), (src_l));\
RMLDZRS_L ((dest_l))
/* Reduction modulo Nmax + 1 */
#define ANDMAX_L(a_l)\
SETDIGITS_L ((a_l), MIN (DIGITS_L (a_l), (USHORT)CLINTMAXDIGIT));\
RMLDZRS_L ((a_l))
#define andmax_l(a_l)\
SETDIGITS_L ((a_l), MIN (DIGITS_L (a_l), (USHORT)CLINTMAXDIGIT));\
RMLDZRS_L ((a_l))
/* Set CLINT-variables to values 0, 1, 2 resp. */
#define SETZERO_L(n_l)\
(*(n_l) = 0)
#define setzero_l(n_l)\
(*(n_l) = 0)
#define SETONE_L(n_l)\
(u2clint_l ((n_l), 1U))
#define setone_l(n_l)\
(u2clint_l ((n_l), 1U))
#define SETTWO_L(n_l)\
(u2clint_l ((n_l), 2U))
#define settwo_l(n_l)\
(u2clint_l ((n_l), 2U))
/* Read the number of digits of a CLINT-variable */
#define DIGITS_L(n_l)\
((unsigned short)*(n_l))
#define digits_l(n_l)\
((unsigned short)*(n_l))
/* Set the number of digits of a CLINT-variable */
#define SETDIGITS_L(n_l, l)\
(*(n_l) = (unsigned short)(l))
#define setdigits_l(n_l, l)\
(*(n_l) = (unsigned short)(l))
/* Increment the number of digits of a CLINT-variable */
#define INCDIGITS_L(n_l)\
(++*(n_l))
#define incdigits_l(n_l)\
(++*(n_l))
/* Decrement the number of digits of a CLINT-variable */
#define DECDIGITS_L(n_l)\
Assert (DIGITS_L (n_l) > 0);\
(--*(n_l))
#define decdigits_l(n_l)\
Assert (DIGITS_L (n_l) > 0);\
(--*(n_l))
/* Pointer to the most significant digit of a CLINT variable */
#define MSDPTR_L(n_l)\
((n_l) + DIGITS_L (n_l))
#define msdptr_l(n_l)\
((n_l) + DIGITS_L (n_l))
/* Pointer to the least significant digit of a CLINT variable */
#define LSDPTR_L(n_l)\
((n_l) + 1)
#define lsdptr_l(n_l)\
((n_l) + 1)
/* Comparisons, setting, testing for evenness and oddness */
#define LT_L(a_l,b_l) \
(cmp_l ((a_l), (b_l)) == -1) /* a_l < b_l */
#define lt_l(a_l,b_l) \
(cmp_l ((a_l), (b_l)) == -1) /* a_l < b_l */
#define LE_L(a_l,b_l) \
(cmp_l ((a_l), (b_l)) < 1) /* a_l <= b_l */
#define le_l(a_l,b_l) \
(cmp_l ((a_l), (b_l)) < 1) /* a_l <= b_l */
#define GT_L(a_l,b_l) \
(cmp_l ((a_l), (b_l)) == 1) /* a_l > b_l */
#define gt_l(a_l,b_l) \
(cmp_l ((a_l), (b_l)) == 1) /* a_l > b_l */
#define GE_L(a_l,b_l) \
(cmp_l ((a_l), (b_l)) > -1) /* a_l >= b_l */
#define ge_l(a_l,b_l) \
(cmp_l ((a_l), (b_l)) > -1) /* a_l >= b_l */
#define GTZ_L(a_l) \
(cmp_l ((a_l), nul_l) == 1) /* a_l > 0 */
#define gtz_l(a_l) \
(cmp_l ((a_l), nul_l) == 1) /* a_l > 0 */
#define EQZ_L(a_l) \
(equ_l ((a_l), nul_l) == 1) /* a_l == 0 */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -