?? gmp.h
字號:
#endif/* __GMP_CAST allows us to use static_cast in C++, so our macros are clean to "g++ -Wold-style-cast". Casts in "extern inline" code within an extern "C" block don't induce these warnings, so __GMP_CAST only needs to be used on documented macros. */#ifdef __cplusplus#define __GMP_CAST(type, expr) (static_cast<type> (expr))#else#define __GMP_CAST(type, expr) ((type) (expr))#endif/* An empty "throw ()" means the function doesn't throw any C++ exceptions, this can save some stack frame info in applications. Currently it's given only on functions which never divide-by-zero etc, don't allocate memory, and are expected to never need to allocate memory. This leaves open the possibility of a C++ throw from a future GMP exceptions scheme. mpz_set_ui etc are omitted to leave open the lazy allocation scheme described in doc/tasks.html. mpz_get_d etc are omitted to leave open exceptions for float overflows. Note that __GMP_NOTHROW must be given on any inlines the same as on their prototypes (for g++ at least, where they're used together). Note also that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like __GMP_ATTRIBUTE_PURE. */#if defined (__cplusplus)#define __GMP_NOTHROW throw ()#else#define __GMP_NOTHROW#endif/* PORTME: What other compilers have a useful "extern inline"? "static inline" would be an acceptable substitute if the compiler (or linker) discards unused statics. *//* gcc has __inline__ in all modes, including strict ansi. Give a prototype for an inline too, so as to correctly specify "dllimport" on windows, in case the function is called rather than inlined. */#ifdef __GNUC__#define __GMP_EXTERN_INLINE extern __inline__#define __GMP_INLINE_PROTOTYPES 1#endif/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes place under -O. Without -O "foo" seems to be emitted whether it's used or not, which is wasteful. "extern inline foo()" isn't useful, the "extern" is apparently ignored, so foo is inlined if possible but also emitted as a global, which causes multiple definition errors when building a shared libgmp. */#ifdef __SCO_VERSION__#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \ && ! defined (__GMP_EXTERN_INLINE)#define __GMP_EXTERN_INLINE static inline#endif#endif/* C++ always has "inline" and since it's a normal feature the linker should discard duplicate non-inlined copies, or if it doesn't then that's a problem for everyone, not just GMP. */#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)#define __GMP_EXTERN_INLINE inline#endif/* Don't do any inlining within a configure run, since if the compiler ends up emitting copies of the code into the object file it can end up demanding the various support routines (like mpn_popcount) for linking, making the "alloca" test and perhaps others fail. And on hppa ia64 a pre-release gcc 3.2 was seen not respecting the "extern" in "extern __inline__", triggering this problem too. */#if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE#undef __GMP_EXTERN_INLINE#endif/* By default, don't give a prototype when there's going to be an inline version. Note in particular that Cray C++ objects to the combination of prototype and inline. */#ifdef __GMP_EXTERN_INLINE#ifndef __GMP_INLINE_PROTOTYPES#define __GMP_INLINE_PROTOTYPES 0#endif#else#define __GMP_INLINE_PROTOTYPES 1#endif#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))#define __GMP_UINT_MAX (~ (unsigned) 0)#define __GMP_ULONG_MAX (~ (unsigned long) 0)#define __GMP_USHRT_MAX ((unsigned short) ~0)/* Allow direct user access to numerator and denominator of a mpq_t object. */#define mpq_numref(Q) (&((Q)->_mp_num))#define mpq_denref(Q) (&((Q)->_mp_den))#if defined (__cplusplus)extern "C" {#endif#define mp_set_memory_functions __gmp_set_memory_functions__GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t), void *(*) (void *, size_t, size_t), void (*) (void *, size_t))) __GMP_NOTHROW;#define mp_bits_per_limb __gmp_bits_per_limb__GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;#define gmp_errno __gmp_errno__GMP_DECLSPEC extern int gmp_errno;#define gmp_version __gmp_version__GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;/* The following for internal use only. Enhancement: __gmp_allocate_func could have "__attribute__ ((malloc))", but current gcc (3.0) doesn't seem to support that. */__GMP_DECLSPEC extern void * (*__gmp_allocate_func) __GMP_PROTO ((size_t));__GMP_DECLSPEC extern void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t));__GMP_DECLSPEC extern void (*__gmp_free_func) __GMP_PROTO ((void *, size_t));/**************** Random number routines. ****************//* obsolete */#define gmp_randinit __gmp_randinit__GMP_DECLSPEC void gmp_randinit __GMP_PROTO ((gmp_randstate_t, gmp_randalg_t, ...));#define gmp_randinit_default __gmp_randinit_default__GMP_DECLSPEC void gmp_randinit_default __GMP_PROTO ((gmp_randstate_t));#define gmp_randinit_lc __gmp_randinit_lc__GMP_DECLSPEC void gmp_randinit_lc __GMP_PROTO ((gmp_randstate_t, mpz_srcptr, unsigned long int, mpz_srcptr));#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp__GMP_DECLSPEC void gmp_randinit_lc_2exp __GMP_PROTO ((gmp_randstate_t, mpz_srcptr, unsigned long int, unsigned long int));#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size__GMP_DECLSPEC int gmp_randinit_lc_2exp_size __GMP_PROTO ((gmp_randstate_t, unsigned long));#define gmp_randseed __gmp_randseed__GMP_DECLSPEC void gmp_randseed __GMP_PROTO ((gmp_randstate_t, mpz_srcptr));#define gmp_randseed_ui __gmp_randseed_ui__GMP_DECLSPEC void gmp_randseed_ui __GMP_PROTO ((gmp_randstate_t, unsigned long int));#define gmp_randclear __gmp_randclear__GMP_DECLSPEC void gmp_randclear __GMP_PROTO ((gmp_randstate_t));/**************** Formatted output routines. ****************/#define gmp_asprintf __gmp_asprintf__GMP_DECLSPEC int gmp_asprintf __GMP_PROTO ((char **, const char *, ...));#define gmp_fprintf __gmp_fprintf#ifdef _GMP_H_HAVE_FILE__GMP_DECLSPEC int gmp_fprintf __GMP_PROTO ((FILE *, const char *, ...));#endif#define gmp_obstack_printf __gmp_obstack_printf#if defined (_GMP_H_HAVE_OBSTACK)__GMP_DECLSPEC int gmp_obstack_printf __GMP_PROTO ((struct obstack *, const char *, ...));#endif#define gmp_obstack_vprintf __gmp_obstack_vprintf#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_obstack_vprintf __GMP_PROTO ((struct obstack *, const char *, va_list));#endif#define gmp_printf __gmp_printf__GMP_DECLSPEC int gmp_printf __GMP_PROTO ((const char *, ...));#define gmp_snprintf __gmp_snprintf__GMP_DECLSPEC int gmp_snprintf __GMP_PROTO ((char *, size_t, const char *, ...));#define gmp_sprintf __gmp_sprintf__GMP_DECLSPEC int gmp_sprintf __GMP_PROTO ((char *, const char *, ...));#define gmp_vasprintf __gmp_vasprintf#if defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vasprintf __GMP_PROTO ((char **, const char *, va_list));#endif#define gmp_vfprintf __gmp_vfprintf#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vfprintf __GMP_PROTO ((FILE *, const char *, va_list));#endif#define gmp_vprintf __gmp_vprintf#if defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vprintf __GMP_PROTO ((const char *, va_list));#endif#define gmp_vsnprintf __gmp_vsnprintf#if defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vsnprintf __GMP_PROTO ((char *, size_t, const char *, va_list));#endif#define gmp_vsprintf __gmp_vsprintf#if defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vsprintf __GMP_PROTO ((char *, const char *, va_list));#endif/**************** Formatted input routines. ****************/#define gmp_fscanf __gmp_fscanf#ifdef _GMP_H_HAVE_FILE__GMP_DECLSPEC int gmp_fscanf __GMP_PROTO ((FILE *, const char *, ...));#endif#define gmp_scanf __gmp_scanf__GMP_DECLSPEC int gmp_scanf __GMP_PROTO ((const char *, ...));#define gmp_sscanf __gmp_sscanf__GMP_DECLSPEC int gmp_sscanf __GMP_PROTO ((const char *, const char *, ...));#define gmp_vfscanf __gmp_vfscanf#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vfscanf __GMP_PROTO ((FILE *, const char *, va_list));#endif#define gmp_vscanf __gmp_vscanf#if defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vscanf __GMP_PROTO ((const char *, va_list));#endif#define gmp_vsscanf __gmp_vsscanf#if defined (_GMP_H_HAVE_VA_LIST)__GMP_DECLSPEC int gmp_vsscanf __GMP_PROTO ((const char *, const char *, va_list));#endif/**************** Integer (i.e. Z) routines. ****************/#define _mpz_realloc __gmpz_realloc#define mpz_realloc __gmpz_realloc__GMP_DECLSPEC void *_mpz_realloc __GMP_PROTO ((mpz_ptr, mp_size_t));#define mpz_abs __gmpz_abs#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)__GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr));#endif#define mpz_add __gmpz_add__GMP_DECLSPEC void mpz_add __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));#define mpz_add_ui __gmpz_add_ui__GMP_DECLSPEC void mpz_add_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));#define mpz_addmul __gmpz_addmul__GMP_DECLSPEC void mpz_addmul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));#define mpz_addmul_ui __gmpz_addmul_ui__GMP_DECLSPEC void mpz_addmul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));#define mpz_and __gmpz_and__GMP_DECLSPEC void mpz_and __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));#define mpz_array_init __gmpz_array_init__GMP_DECLSPEC void mpz_array_init __GMP_PROTO ((mpz_ptr, mp_size_t, mp_size_t));#define mpz_bin_ui __gmpz_bin_ui__GMP_DECLSPEC void mpz_bin_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));#define mpz_bin_uiui __gmpz_bin_uiui__GMP_DECLSPEC void mpz_bin_uiui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));#define mpz_cdiv_q __gmpz_cdiv_q__GMP_DECLSPEC void mpz_cdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp__GMP_DECLSPEC void mpz_cdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));#define mpz_cdiv_qr __gmpz_cdiv_qr__GMP_DECLSPEC void mpz_cdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));#define mpz_cdiv_r __gmpz_cdiv_r__GMP_DECLSPEC void mpz_cdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp__GMP_DECLSPEC void mpz_cdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));#define mpz_cdiv_ui __gmpz_cdiv_ui__GMP_DECLSPEC unsigned long int mpz_cdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;#define mpz_clear __gmpz_clear__GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr));#define mpz_clrbit __gmpz_clrbit__GMP_DECLSPEC void mpz_clrbit __GMP_PROTO ((mpz_ptr, unsigned long int));#define mpz_cmp __gmpz_cmp__GMP_DECLSPEC int mpz_cmp __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;#define mpz_cmp_d __gmpz_cmp_d__GMP_DECLSPEC int mpz_cmp_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;#define _mpz_cmp_si __gmpz_cmp_si__GMP_DECLSPEC int _mpz_cmp_si __GMP_PROTO ((mpz_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;#define _mpz_cmp_ui __gmpz_cmp_ui__GMP_DECLSPEC int _mpz_cmp_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;#define mpz_cmpabs __gmpz_cmpabs__GMP_DECLSPEC int mpz_cmpabs __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;#define mpz_cmpabs_d __gmpz_cmpabs_d__GMP_DECLSPEC int mpz_cmpabs_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;#define mpz_cmpabs_ui __gmpz_cmpabs_ui__GMP_DECLSPEC int mpz_cmpabs_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;#define mpz_com __gmpz_com__GMP_DECLSPEC void mpz_com __GMP_PROTO ((mpz_ptr, mpz_srcptr));#define mpz_congruent_p __gmpz_congruent_p__GMP_DECLSPEC int mpz_congruent_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p__GMP_DECLSPEC int mpz_congruent_2exp_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;#define mpz_congruent_ui_p __gmpz_congruent_ui_p__GMP_DECLSPEC int mpz_congruent_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long, unsigned long)) __GMP_ATTRIBUTE_PURE;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -