[Gmp-commit] /var/hg/gmp: Allow C++ references to mpn_ glue functions.

mercurial at gmplib.org mercurial at gmplib.org
Mon Nov 17 20:57:07 UTC 2014


details:   /var/hg/gmp/rev/e5c858f8e7cc
changeset: 16520:e5c858f8e7cc
user:      Torbjorn Granlund <torbjorng at google.com>
date:      Mon Nov 17 21:57:04 2014 +0100
description:
Allow C++ references to mpn_ glue functions.

diffstat:

 ChangeLog  |   5 +++++
 longlong.h |  14 ++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r 0f3ee27fb06b -r e5c858f8e7cc ChangeLog
--- a/ChangeLog	Sat Nov 15 20:46:48 2014 +0100
+++ b/ChangeLog	Mon Nov 17 21:57:04 2014 +0100
@@ -1,3 +1,8 @@
+2014-11-17  Torbjörn Granlund  <torbjorng at google.com>
+
+	* longlong.h (__longlong_h_C): New macro.
+	(mpn_umul_ppmm, etc): Use it for C++ support.
+
 2014-11-15  Torbjörn Granlund  <torbjorng at google.com>
 
 	* tests/mpz/reuse.c: Make function vectors 'static'.
diff -r 0f3ee27fb06b -r e5c858f8e7cc longlong.h
--- a/longlong.h	Sat Nov 15 20:46:48 2014 +0100
+++ b/longlong.h	Mon Nov 17 21:57:04 2014 +0100
@@ -1884,13 +1884,19 @@
 #endif
 
 
+#if defined (__cplusplus)
+#define __longlong_h_C "C"
+#else
+#define __longlong_h_C
+#endif
+
 /* Use mpn_umul_ppmm or mpn_udiv_qrnnd functions, if they exist.  The "_r"
    forms have "reversed" arguments, meaning the pointer is last, which
    sometimes allows better parameter passing, in particular on 64-bit
    hppa. */
 
 #define mpn_umul_ppmm  __MPN(umul_ppmm)
-extern UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype);
+extern __longlong_h_C UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype);
 
 #if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm  \
   && ! defined (LONGLONG_STANDALONE)
@@ -1903,7 +1909,7 @@
 #endif
 
 #define mpn_umul_ppmm_r  __MPN(umul_ppmm_r)
-extern UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *);
+extern __longlong_h_C UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *);
 
 #if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm_r	\
   && ! defined (LONGLONG_STANDALONE)
@@ -1916,7 +1922,7 @@
 #endif
 
 #define mpn_udiv_qrnnd  __MPN(udiv_qrnnd)
-extern UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype);
+extern __longlong_h_C UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype);
 
 #if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd	\
   && ! defined (LONGLONG_STANDALONE)
@@ -1930,7 +1936,7 @@
 #endif
 
 #define mpn_udiv_qrnnd_r  __MPN(udiv_qrnnd_r)
-extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
+extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
 
 #if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd_r	\
   && ! defined (LONGLONG_STANDALONE)


More information about the gmp-commit mailing list