1Binary files dist.orig/ChangeLog and dist.nbsd/ChangeLog differ
2diff -rNU3 dist.orig/Makefile.am dist.nbsd/Makefile.am
3--- dist.orig/Makefile.am	Mon May 20 14:59:56 2013
4+++ dist.nbsd/Makefile.am	Wed Feb 19 16:34:37 2014
5@@ -74,6 +74,7 @@
6 #        5.1.0   11:0:1    7:0:3     -
7 #        5.1.1   11:1:1    7:1:3     -
8 #        5.1.2   11:2:1    7:2:3     -
9+#        5.1.3   11:3:1    7:3:3     -
10 #
11 # Starting at 3:0:0 is a slight abuse of the versioning system, but it
12 # ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux
13@@ -87,11 +88,11 @@
14 # libgmpxx.so.3.0.4) incrementing, to make it clear which GMP it's from.
15
16 LIBGMP_LT_CURRENT    = 11
17-LIBGMP_LT_REVISION   = 2
18+LIBGMP_LT_REVISION   = 3
19 LIBGMP_LT_AGE        = 1
20
21 LIBGMPXX_LT_CURRENT  = 7
22-LIBGMPXX_LT_REVISION = 2
23+LIBGMPXX_LT_REVISION = 3
24 LIBGMPXX_LT_AGE      = 3
25
26
27diff -rNU3 dist.orig/Makefile.in dist.nbsd/Makefile.in
28--- dist.orig/Makefile.in	Mon May 20 15:00:04 2013
29+++ dist.nbsd/Makefile.in	Wed Feb 19 16:34:37 2014
30@@ -86,6 +86,7 @@
31 #        5.1.0   11:0:1    7:0:3     -
32 #        5.1.1   11:1:1    7:1:3     -
33 #        5.1.2   11:2:1    7:2:3     -
34+#        5.1.3   11:3:1    7:3:3     -
35 #
36 # Starting at 3:0:0 is a slight abuse of the versioning system, but it
37 # ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux
38@@ -446,10 +447,10 @@
39 top_builddir = @top_builddir@
40 top_srcdir = @top_srcdir@
41 LIBGMP_LT_CURRENT = 11
42-LIBGMP_LT_REVISION = 2
43+LIBGMP_LT_REVISION = 3
44 LIBGMP_LT_AGE = 1
45 LIBGMPXX_LT_CURRENT = 7
46-LIBGMPXX_LT_REVISION = 2
47+LIBGMPXX_LT_REVISION = 3
48 LIBGMPXX_LT_AGE = 3
49 SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
50
51@@ -1165,7 +1166,8 @@
52 uninstall: uninstall-recursive
53
54 install-am: all-am
55-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
56+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am
57+	@$(MAKE) $(AM_MAKEFLAGS) install-data-am
58
59 installcheck: installcheck-recursive
60 install-strip:
61diff -rNU3 dist.orig/NEWS dist.nbsd/NEWS
62--- dist.orig/NEWS	Mon May 20 14:59:56 2013
63+++ dist.nbsd/NEWS	Wed Feb 19 16:34:37 2014
64@@ -5,6 +5,29 @@
65 medium, provided this notice is preserved.
66
67
68+Changes between GMP version 5.1.2 and 5.1.3
69+
70+  BUGS FIXED
71+  * The internal functions mpn_sbpi1_div_qr_sec mpn_sbpi1_div_r_sec could
72+    compute garbage with a low probability.  They are now rewritten, and the
73+    test code has been improved.
74+
75+  * A bug in the ia64 implementation of mpn_divrem_2, clobbering some
76+    callee-save registers, has been fixed. This is an internal
77+    function, with the bug manifesting itself as miscomputation in,
78+    e.g., mpn_sqrtrem.
79+
80+  * The documentation now correctly says 'const' for input arguments.
81+
82+  SPEEDUPS
83+  * None.
84+
85+  FEATURES
86+  * None.
87+
88+  MISC
89+  * None.
90+
91 Changes between GMP version 5.1.1 and 5.1.2
92
93   BUGS FIXED
94diff -rNU3 dist.orig/acinclude.m4 dist.nbsd/acinclude.m4
95--- dist.orig/acinclude.m4	Mon May 20 14:59:56 2013
96+++ dist.nbsd/acinclude.m4	Wed Feb 19 16:34:37 2014
97@@ -33,6 +33,9 @@
98 define(IA64_PATTERN,
99 [[ia64*-*-* | itanium-*-* | itanium2-*-*]])
100
101+define(M5407_PATTERN,
102+[[m5407-*-*]])
103+
104 dnl  Need to be careful not to match m6811, m6812, m68hc11 and m68hc12, all
105 dnl  of which config.sub accepts.  (Though none of which are likely to work
106 dnl  with GMP.)
107diff -rNU3 dist.orig/config.guess dist.nbsd/config.guess
108--- dist.orig/config.guess	Mon May 20 14:59:56 2013
109+++ dist.nbsd/config.guess	Wed Feb 19 16:34:37 2014
110@@ -945,8 +945,8 @@
111
112 # -------------------------------------------------------------------------
113 # Use an exact cpu, if possible
114-
115-if test -n "$exact_cpu"; then
116+# Disabled for NetBSD cross builds
117+if false && test -n "$exact_cpu"; then
118   echo "$exact_cpu$guess_rest"
119 else
120   echo "$guess_full"
121diff -rNU3 dist.orig/configfsf.sub dist.nbsd/configfsf.sub
122--- dist.orig/configfsf.sub	Mon May 20 14:59:56 2013
123+++ dist.nbsd/configfsf.sub	Wed Feb 19 16:34:37 2014
124@@ -124,7 +124,7 @@
125 case $maybe_os in
126   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
127   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
128-  knetbsd*-gnu* | netbsd*-gnu* | \
129+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-*eabi* | \
130   kopensolaris*-gnu* | \
131   storm-chaos* | os2-emx* | rtmk-nova*)
132     os=-$maybe_os
133@@ -334,7 +334,8 @@
134 		basic_machine=$basic_machine-unknown
135 		os=-none
136 		;;
137-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
138+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | m5407 \
139+	| v70 | w65 | z8k)
140 		;;
141 	ms1)
142 		basic_machine=mt-unknown
143@@ -390,6 +391,7 @@
144 	| le32-* | le64-* \
145 	| lm32-* \
146 	| m32c-* | m32r-* | m32rle-* \
147+	| m5200-* | m5407-* \
148 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
149 	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
150 	| microblaze-* | microblazeel-* \
151diff -rNU3 dist.orig/configure dist.nbsd/configure
152--- dist.orig/configure	Mon May 20 15:00:02 2013
153+++ dist.nbsd/configure	Wed Feb 19 16:34:37 2014
154@@ -1,7 +1,7 @@
155 #! /bin/sh
156 # From configure.ac Revision.
157 # Guess values for system-dependent variables and create Makefiles.
158-# Generated by GNU Autoconf 2.69 for GNU MP 5.1.2.
159+# Generated by GNU Autoconf 2.69 for GNU MP 5.1.3.
160 #
161 # Report bugs to <gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html>.
162 #
163@@ -613,8 +613,8 @@
164 # Identity of this package.
165 PACKAGE_NAME='GNU MP'
166 PACKAGE_TARNAME='gmp'
167-PACKAGE_VERSION='5.1.2'
168-PACKAGE_STRING='GNU MP 5.1.2'
169+PACKAGE_VERSION='5.1.3'
170+PACKAGE_STRING='GNU MP 5.1.3'
171 PACKAGE_BUGREPORT='gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html'
172 PACKAGE_URL='http://www.gnu.org/software/gmp/'
173
174@@ -1395,7 +1395,7 @@
175   # Omit some internal or obsolete options to make the list less imposing.
176   # This message is too long to be a string in the A/UX 3.1 sh.
177   cat <<_ACEOF
178-\`configure' configures GNU MP 5.1.2 to adapt to many kinds of systems.
179+\`configure' configures GNU MP 5.1.3 to adapt to many kinds of systems.
180
181 Usage: $0 [OPTION]... [VAR=VALUE]...
182
183@@ -1465,7 +1465,7 @@
184
185 if test -n "$ac_init_help"; then
186   case $ac_init_help in
187-     short | recursive ) echo "Configuration of GNU MP 5.1.2:";;
188+     short | recursive ) echo "Configuration of GNU MP 5.1.3:";;
189    esac
190   cat <<\_ACEOF
191
192@@ -1597,7 +1597,7 @@
193 test -n "$ac_init_help" && exit $ac_status
194 if $ac_init_version; then
195   cat <<\_ACEOF
196-GNU MP configure 5.1.2
197+GNU MP configure 5.1.3
198 generated by GNU Autoconf 2.69
199
200 Copyright (C) 2012 Free Software Foundation, Inc.
201@@ -2639,7 +2639,7 @@
202 This file contains any messages produced by compilers while
203 running configure, to aid debugging if configure makes a mistake.
204
205-It was created by GNU MP $as_me 5.1.2, which was
206+It was created by GNU MP $as_me 5.1.3, which was
207 generated by GNU Autoconf 2.69.  Invocation command line was
208
209   $ $0 $@
210@@ -3566,7 +3566,7 @@
211
212 # Define the identity of the package.
213  PACKAGE='gmp'
214- VERSION='5.1.2'
215+ VERSION='5.1.3'
216
217
218 cat >>confdefs.h <<_ACEOF
219@@ -4377,6 +4377,16 @@
220     ;;
221
222
223+  # Motorola Coldfire
224+  #
225+  m5407-*-*)
226+
227+    gcc_cflags="$gcc_cflags $fomit_frame_pointer"
228+    gcc_cflags_optlist="arch"
229+    gcc_cflags_arch="-m5407"
230+  ;;
231+
232+
233   # Motorola 68k
234   #
235   m68k-*-* | m68[0-9][0-9][0-9]-*-*)
236@@ -30111,7 +30121,7 @@
237 # report actual input values of CONFIG_FILES etc. instead of their
238 # values after options handling.
239 ac_log="
240-This file was extended by GNU MP $as_me 5.1.2, which was
241+This file was extended by GNU MP $as_me 5.1.3, which was
242 generated by GNU Autoconf 2.69.  Invocation command line was
243
244   CONFIG_FILES    = $CONFIG_FILES
245@@ -30183,7 +30193,7 @@
246 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
247 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
248 ac_cs_version="\\
249-GNU MP config.status 5.1.2
250+GNU MP config.status 5.1.3
251 configured by $0, generated by GNU Autoconf 2.69,
252   with options \\"\$ac_cs_config\\"
253
254diff -rNU3 dist.orig/configure.ac dist.nbsd/configure.ac
255--- dist.orig/configure.ac	Mon May 20 14:59:56 2013
256+++ dist.nbsd/configure.ac	Wed Feb 19 16:34:37 2014
257@@ -25,7 +25,7 @@
258 AC_COPYRIGHT(GMP_COPYRIGHT)
259 AH_TOP(/*GMP_COPYRIGHT*/)
260
261-AC_REVISION($Revision$)
262+AC_REVISION($Revision: 1.1.1.1 $)
263 AC_PREREQ(2.59)
264 AC_INIT(GNU MP, GMP_VERSION, [gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html], gmp)
265 AC_CONFIG_SRCDIR(gmp-impl.h)
266diff -rNU3 dist.orig/demos/calc/calc.c dist.nbsd/demos/calc/calc.c
267--- dist.orig/demos/calc/calc.c	Mon May 20 15:00:17 2013
268+++ dist.nbsd/demos/calc/calc.c	Wed Feb 19 16:34:37 2014
269@@ -1,8 +1,8 @@
270-/* A Bison parser, made by GNU Bison 2.5.1.  */
271+/* A Bison parser, made by GNU Bison 2.7.12-4996.  */
272
273 /* Bison implementation for Yacc-like parsers in C
274
275-      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
276+      Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
277
278    This program is free software: you can redistribute it and/or modify
279    it under the terms of the GNU General Public License as published by
280@@ -44,7 +44,7 @@
281 #define YYBISON 1
282
283 /* Bison version.  */
284-#define YYBISON_VERSION "2.5.1"
285+#define YYBISON_VERSION "2.7.12-4996"
286
287 /* Skeleton name.  */
288 #define YYSKELETON_NAME "yacc.c"
289@@ -58,14 +58,11 @@
290 /* Pull parsers.  */
291 #define YYPULL 1
292
293-/* Using locations.  */
294-#define YYLSP_NEEDED 0
295
296
297
298 /* Copy the first part of user declarations.  */
299-
300-/* Line 268 of yacc.c  */
301+/* Line 371 of yacc.c  */
302 #line 1 "calc.y"
303
304 /* A simple integer desk calculator using yacc and gmp.
305@@ -207,10 +204,9 @@
306     }
307
308
309+/* Line 371 of yacc.c  */
310+#line 209 "calc.c"
311
312-/* Line 268 of yacc.c  */
313-#line 213 "calc.c"
314-
315 # ifndef YY_NULL
316 #  if defined __cplusplus && 201103L <= __cplusplus
317 #   define YY_NULL nullptr
318@@ -219,11 +215,6 @@
319 #  endif
320 # endif
321
322-/* Enabling traces.  */
323-#ifndef YYDEBUG
324-# define YYDEBUG 0
325-#endif
326-
327 /* Enabling verbose error messages.  */
328 #ifdef YYERROR_VERBOSE
329 # undef YYERROR_VERBOSE
330@@ -232,12 +223,18 @@
331 # define YYERROR_VERBOSE 0
332 #endif
333
334-/* Enabling the token table.  */
335-#ifndef YYTOKEN_TABLE
336-# define YYTOKEN_TABLE 0
337+/* In a future release of Bison, this section will be replaced
338+   by #include "y.tab.h".  */
339+#ifndef YY_YY_Y_TAB_H_INCLUDED
340+# define YY_YY_Y_TAB_H_INCLUDED
341+/* Enabling traces.  */
342+#ifndef YYDEBUG
343+# define YYDEBUG 0
344 #endif
345+#if YYDEBUG
346+extern int yydebug;
347+#endif
348
349-
350 /* Tokens.  */
351 #ifndef YYTOKENTYPE
352 # define YYTOKENTYPE
353@@ -306,34 +303,47 @@
354
355
356
357-
358 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
359 typedef union YYSTYPE
360 {
361-
362-/* Line 295 of yacc.c  */
363+/* Line 387 of yacc.c  */
364 #line 142 "calc.y"
365
366   char  *str;
367   int   var;
368
369
370-
371-/* Line 295 of yacc.c  */
372-#line 324 "calc.c"
373+/* Line 387 of yacc.c  */
374+#line 318 "calc.c"
375 } YYSTYPE;
376 # define YYSTYPE_IS_TRIVIAL 1
377 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
378 # define YYSTYPE_IS_DECLARED 1
379 #endif
380
381+extern YYSTYPE yylval;
382
383-/* Copy the second part of user declarations.  */
384+#ifdef YYPARSE_PARAM
385+#if defined __STDC__ || defined __cplusplus
386+int yyparse (void *YYPARSE_PARAM);
387+#else
388+int yyparse ();
389+#endif
390+#else /* ! YYPARSE_PARAM */
391+#if defined __STDC__ || defined __cplusplus
392+int yyparse (void);
393+#else
394+int yyparse ();
395+#endif
396+#endif /* ! YYPARSE_PARAM */
397
398+#endif /* !YY_YY_Y_TAB_H_INCLUDED  */
399
400-/* Line 345 of yacc.c  */
401-#line 336 "calc.c"
402+/* Copy the second part of user declarations.  */
403
404+/* Line 390 of yacc.c  */
405+#line 346 "calc.c"
406+
407 #ifdef short
408 # undef short
409 #endif
410@@ -385,24 +395,33 @@
411 # if defined YYENABLE_NLS && YYENABLE_NLS
412 #  if ENABLE_NLS
413 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
414-#   define YY_(msgid) dgettext ("bison-runtime", msgid)
415+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
416 #  endif
417 # endif
418 # ifndef YY_
419-#  define YY_(msgid) msgid
420+#  define YY_(Msgid) Msgid
421 # endif
422 #endif
423
424+#ifndef __attribute__
425+/* This feature is available in gcc versions 2.5 and later.  */
426+# if (! defined __GNUC__ || __GNUC__ < 2 \
427+      || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
428+#  define __attribute__(Spec) /* empty */
429+# endif
430+#endif
431+
432 /* Suppress unused-variable warnings by "using" E.  */
433 #if ! defined lint || defined __GNUC__
434-# define YYUSE(e) ((void) (e))
435+# define YYUSE(E) ((void) (E))
436 #else
437-# define YYUSE(e) /* empty */
438+# define YYUSE(E) /* empty */
439 #endif
440
441+
442 /* Identity function, used to suppress warnings about constant conditions.  */
443 #ifndef lint
444-# define YYID(n) (n)
445+# define YYID(N) (N)
446 #else
447 #if (defined __STDC__ || defined __C99__FUNC__ \
448      || defined __cplusplus || defined _MSC_VER)
449@@ -651,7 +670,7 @@
450 };
451 #endif
452
453-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
454+#if YYDEBUG || YYERROR_VERBOSE || 0
455 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
456    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
457 static const char *const yytname[] =
458@@ -812,11 +831,11 @@
459        0,    59,    60
460 };
461
462-#define yypact_value_is_default(yystate) \
463-  ((yystate) == (-39))
464+#define yypact_value_is_default(Yystate) \
465+  (!!((Yystate) == (-39)))
466
467-#define yytable_value_is_error(yytable_value) \
468-  ((yytable_value) == (-8))
469+#define yytable_value_is_error(Yytable_value) \
470+  (!!((Yytable_value) == (-8)))
471
472 static const yytype_int8 yycheck[] =
473 {
474@@ -940,46 +959,18 @@
475     }								\
476 while (YYID (0))
477
478-
479+/* Error token number */
480 #define YYTERROR	1
481 #define YYERRCODE	256
482
483
484-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
485-   If N is 0, then set CURRENT to the empty location which ends
486-   the previous symbol: RHS[0] (always defined).  */
487-
488-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
489-#ifndef YYLLOC_DEFAULT
490-# define YYLLOC_DEFAULT(Current, Rhs, N)				\
491-    do									\
492-      if (YYID (N))                                                    \
493-	{								\
494-	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
495-	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
496-	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
497-	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
498-	}								\
499-      else								\
500-	{								\
501-	  (Current).first_line   = (Current).last_line   =		\
502-	    YYRHSLOC (Rhs, 0).last_line;				\
503-	  (Current).first_column = (Current).last_column =		\
504-	    YYRHSLOC (Rhs, 0).last_column;				\
505-	}								\
506-    while (YYID (0))
507-#endif
508-
509-
510 /* This macro is provided for backward compatibility. */
511-
512 #ifndef YY_LOCATION_PRINT
513 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
514 #endif
515
516
517 /* YYLEX -- calling `yylex' with the right arguments.  */
518-
519 #ifdef YYLEX_PARAM
520 # define YYLEX yylex (YYLEX_PARAM)
521 #else
522@@ -1039,11 +1030,7 @@
523 # else
524   YYUSE (yyoutput);
525 # endif
526-  switch (yytype)
527-    {
528-      default:
529-	break;
530-    }
531+  YYUSE (yytype);
532 }
533
534
535@@ -1284,7 +1271,6 @@
536 {
537   YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
538   YYSIZE_T yysize = yysize0;
539-  YYSIZE_T yysize1;
540   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
541   /* Internationalized format string. */
542   const char *yyformat = YY_NULL;
543@@ -1347,11 +1333,13 @@
544                     break;
545                   }
546                 yyarg[yycount++] = yytname[yyx];
547-                yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
548-                if (! (yysize <= yysize1
549-                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
550-                  return 2;
551-                yysize = yysize1;
552+                {
553+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
554+                  if (! (yysize <= yysize1
555+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
556+                    return 2;
557+                  yysize = yysize1;
558+                }
559               }
560         }
561     }
562@@ -1371,10 +1359,12 @@
563 # undef YYCASE_
564     }
565
566-  yysize1 = yysize + yystrlen (yyformat);
567-  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
568-    return 2;
569-  yysize = yysize1;
570+  {
571+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
572+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
573+      return 2;
574+    yysize = yysize1;
575+  }
576
577   if (*yymsg_alloc < yysize)
578     {
579@@ -1430,36 +1420,26 @@
580     yymsg = "Deleting";
581   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
582
583-  switch (yytype)
584-    {
585-
586-      default:
587-	break;
588-    }
589+  YYUSE (yytype);
590 }
591
592
593-/* Prevent warnings from -Wmissing-prototypes.  */
594-#ifdef YYPARSE_PARAM
595-#if defined __STDC__ || defined __cplusplus
596-int yyparse (void *YYPARSE_PARAM);
597-#else
598-int yyparse ();
599-#endif
600-#else /* ! YYPARSE_PARAM */
601-#if defined __STDC__ || defined __cplusplus
602-int yyparse (void);
603-#else
604-int yyparse ();
605-#endif
606-#endif /* ! YYPARSE_PARAM */
607
608
609 /* The lookahead symbol.  */
610 int yychar;
611
612+
613+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
614+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
615+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
616+#endif
617+#ifndef YY_INITIAL_VALUE
618+# define YY_INITIAL_VALUE(Value) /* Nothing. */
619+#endif
620+
621 /* The semantic value of the lookahead symbol.  */
622-YYSTYPE yylval;
623+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
624
625 /* Number of syntax errors so far.  */
626 int yynerrs;
627@@ -1517,7 +1497,7 @@
628   int yyn;
629   int yyresult;
630   /* Lookahead token as an internal (translated) token number.  */
631-  int yytoken;
632+  int yytoken = 0;
633   /* The variables used to return semantic value and location from the
634      action routines.  */
635   YYSTYPE yyval;
636@@ -1535,9 +1515,8 @@
637      Keep to zero when no symbol should be popped.  */
638   int yylen = 0;
639
640-  yytoken = 0;
641-  yyss = yyssa;
642-  yyvs = yyvsa;
643+  yyssp = yyss = yyssa;
644+  yyvsp = yyvs = yyvsa;
645   yystacksize = YYINITDEPTH;
646
647   YYDPRINTF ((stderr, "Starting parse\n"));
648@@ -1546,14 +1525,6 @@
649   yyerrstatus = 0;
650   yynerrs = 0;
651   yychar = YYEMPTY; /* Cause a token to be read.  */
652-
653-  /* Initialize stack pointers.
654-     Waste one element of value and location stack
655-     so that they stay on the same level as the state stack.
656-     The wasted elements are never initialized.  */
657-  yyssp = yyss;
658-  yyvsp = yyvs;
659-
660   goto yysetstate;
661
662 /*------------------------------------------------------------.
663@@ -1694,7 +1665,9 @@
664   yychar = YYEMPTY;
665
666   yystate = yyn;
667+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
668   *++yyvsp = yylval;
669+  YY_IGNORE_MAYBE_UNINITIALIZED_END
670
671   goto yynewstate;
672
673@@ -1731,15 +1704,13 @@
674   switch (yyn)
675     {
676         case 6:
677-
678-/* Line 1810 of yacc.c  */
679+/* Line 1787 of yacc.c  */
680 #line 173 "calc.y"
681     { sp = stack[0]; yyerrok; }
682     break;
683
684   case 8:
685-
686-/* Line 1810 of yacc.c  */
687+/* Line 1787 of yacc.c  */
688 #line 177 "calc.y"
689     {
690       mpz_out_str (stdout, obase, sp); putchar ('\n');
691@@ -1749,8 +1720,7 @@
692     break;
693
694   case 9:
695-
696-/* Line 1810 of yacc.c  */
697+/* Line 1787 of yacc.c  */
698 #line 182 "calc.y"
699     {
700       CHECK_VARIABLE ((yyvsp[(1) - (3)].var));
701@@ -1761,234 +1731,202 @@
702     break;
703
704   case 10:
705-
706-/* Line 1810 of yacc.c  */
707+/* Line 1787 of yacc.c  */
708 #line 188 "calc.y"
709     { calc_help (); }
710     break;
711
712   case 11:
713-
714-/* Line 1810 of yacc.c  */
715+/* Line 1787 of yacc.c  */
716 #line 189 "calc.y"
717     { ibase = 16; obase = -16; }
718     break;
719
720   case 12:
721-
722-/* Line 1810 of yacc.c  */
723+/* Line 1787 of yacc.c  */
724 #line 190 "calc.y"
725     { ibase = 0;  obase = 10; }
726     break;
727
728   case 13:
729-
730-/* Line 1810 of yacc.c  */
731+/* Line 1787 of yacc.c  */
732 #line 191 "calc.y"
733     { exit (0); }
734     break;
735
736   case 15:
737-
738-/* Line 1810 of yacc.c  */
739+/* Line 1787 of yacc.c  */
740 #line 198 "calc.y"
741     { sp--; mpz_add    (sp, sp, sp+1); }
742     break;
743
744   case 16:
745-
746-/* Line 1810 of yacc.c  */
747+/* Line 1787 of yacc.c  */
748 #line 199 "calc.y"
749     { sp--; mpz_sub    (sp, sp, sp+1); }
750     break;
751
752   case 17:
753-
754-/* Line 1810 of yacc.c  */
755+/* Line 1787 of yacc.c  */
756 #line 200 "calc.y"
757     { sp--; mpz_mul    (sp, sp, sp+1); }
758     break;
759
760   case 18:
761-
762-/* Line 1810 of yacc.c  */
763+/* Line 1787 of yacc.c  */
764 #line 201 "calc.y"
765     { sp--; mpz_fdiv_q (sp, sp, sp+1); }
766     break;
767
768   case 19:
769-
770-/* Line 1810 of yacc.c  */
771+/* Line 1787 of yacc.c  */
772 #line 202 "calc.y"
773     { sp--; mpz_fdiv_r (sp, sp, sp+1); }
774     break;
775
776   case 20:
777-
778-/* Line 1810 of yacc.c  */
779+/* Line 1787 of yacc.c  */
780 #line 203 "calc.y"
781     { CHECK_UI ("Exponent", sp);
782                     sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }
783     break;
784
785   case 21:
786-
787-/* Line 1810 of yacc.c  */
788+/* Line 1787 of yacc.c  */
789 #line 205 "calc.y"
790     { CHECK_UI ("Shift count", sp);
791                     sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }
792     break;
793
794   case 22:
795-
796-/* Line 1810 of yacc.c  */
797+/* Line 1787 of yacc.c  */
798 #line 207 "calc.y"
799     { CHECK_UI ("Shift count", sp);
800                     sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }
801     break;
802
803   case 23:
804-
805-/* Line 1810 of yacc.c  */
806+/* Line 1787 of yacc.c  */
807 #line 209 "calc.y"
808     { CHECK_UI ("Factorial", sp);
809                     mpz_fac_ui (sp, mpz_get_ui (sp)); }
810     break;
811
812   case 24:
813-
814-/* Line 1810 of yacc.c  */
815+/* Line 1787 of yacc.c  */
816 #line 211 "calc.y"
817     { mpz_neg (sp, sp); }
818     break;
819
820   case 25:
821-
822-/* Line 1810 of yacc.c  */
823+/* Line 1787 of yacc.c  */
824 #line 213 "calc.y"
825     { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <  0); }
826     break;
827
828   case 26:
829-
830-/* Line 1810 of yacc.c  */
831+/* Line 1787 of yacc.c  */
832 #line 214 "calc.y"
833     { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }
834     break;
835
836   case 27:
837-
838-/* Line 1810 of yacc.c  */
839+/* Line 1787 of yacc.c  */
840 #line 215 "calc.y"
841     { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }
842     break;
843
844   case 28:
845-
846-/* Line 1810 of yacc.c  */
847+/* Line 1787 of yacc.c  */
848 #line 216 "calc.y"
849     { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }
850     break;
851
852   case 29:
853-
854-/* Line 1810 of yacc.c  */
855+/* Line 1787 of yacc.c  */
856 #line 217 "calc.y"
857     { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }
858     break;
859
860   case 30:
861-
862-/* Line 1810 of yacc.c  */
863+/* Line 1787 of yacc.c  */
864 #line 218 "calc.y"
865     { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >  0); }
866     break;
867
868   case 31:
869-
870-/* Line 1810 of yacc.c  */
871+/* Line 1787 of yacc.c  */
872 #line 220 "calc.y"
873     { sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }
874     break;
875
876   case 32:
877-
878-/* Line 1810 of yacc.c  */
879+/* Line 1787 of yacc.c  */
880 #line 221 "calc.y"
881     { sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }
882     break;
883
884   case 33:
885-
886-/* Line 1810 of yacc.c  */
887+/* Line 1787 of yacc.c  */
888 #line 223 "calc.y"
889     { mpz_abs (sp, sp); }
890     break;
891
892   case 34:
893-
894-/* Line 1810 of yacc.c  */
895+/* Line 1787 of yacc.c  */
896 #line 224 "calc.y"
897     { sp--; CHECK_UI ("Binomial base", sp+1);
898                                    mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }
899     break;
900
901   case 35:
902-
903-/* Line 1810 of yacc.c  */
904+/* Line 1787 of yacc.c  */
905 #line 226 "calc.y"
906     { CHECK_UI ("Fibonacci", sp);
907                                    mpz_fib_ui (sp, mpz_get_ui (sp)); }
908     break;
909
910   case 37:
911-
912-/* Line 1810 of yacc.c  */
913+/* Line 1787 of yacc.c  */
914 #line 229 "calc.y"
915     { sp--; mpz_set_si (sp,
916                                          mpz_kronecker (sp, sp+1)); }
917     break;
918
919   case 39:
920-
921-/* Line 1810 of yacc.c  */
922+/* Line 1787 of yacc.c  */
923 #line 232 "calc.y"
924     { CHECK_UI ("Lucas number", sp);
925                                    mpz_lucnum_ui (sp, mpz_get_ui (sp)); }
926     break;
927
928   case 40:
929-
930-/* Line 1810 of yacc.c  */
931+/* Line 1787 of yacc.c  */
932 #line 234 "calc.y"
933     { mpz_nextprime (sp, sp); }
934     break;
935
936   case 41:
937-
938-/* Line 1810 of yacc.c  */
939+/* Line 1787 of yacc.c  */
940 #line 235 "calc.y"
941     { sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }
942     break;
943
944   case 42:
945-
946-/* Line 1810 of yacc.c  */
947+/* Line 1787 of yacc.c  */
948 #line 236 "calc.y"
949     { sp--; CHECK_UI ("Nth-root", sp+1);
950                                    mpz_root (sp, sp, mpz_get_ui (sp+1)); }
951     break;
952
953   case 43:
954-
955-/* Line 1810 of yacc.c  */
956+/* Line 1787 of yacc.c  */
957 #line 238 "calc.y"
958     { mpz_sqrt (sp, sp); }
959     break;
960
961   case 44:
962-
963-/* Line 1810 of yacc.c  */
964+/* Line 1787 of yacc.c  */
965 #line 240 "calc.y"
966     {
967         sp++;
968@@ -1999,8 +1937,7 @@
969     break;
970
971   case 45:
972-
973-/* Line 1810 of yacc.c  */
974+/* Line 1787 of yacc.c  */
975 #line 246 "calc.y"
976     {
977         sp++;
978@@ -2014,23 +1951,20 @@
979     break;
980
981   case 47:
982-
983-/* Line 1810 of yacc.c  */
984+/* Line 1787 of yacc.c  */
985 #line 258 "calc.y"
986     { sp--; mpz_gcd (sp, sp, sp+1); }
987     break;
988
989   case 49:
990-
991-/* Line 1810 of yacc.c  */
992+/* Line 1787 of yacc.c  */
993 #line 262 "calc.y"
994     { sp--; mpz_lcm (sp, sp, sp+1); }
995     break;
996
997
998-
999-/* Line 1810 of yacc.c  */
1000-#line 2034 "calc.c"
1001+/* Line 1787 of yacc.c  */
1002+#line 1968 "calc.c"
1003       default: break;
1004     }
1005   /* User semantic actions sometimes alter yychar, and that requires
1006@@ -2193,7 +2127,9 @@
1007       YY_STACK_PRINT (yyss, yyssp);
1008     }
1009
1010+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1011   *++yyvsp = yylval;
1012+  YY_IGNORE_MAYBE_UNINITIALIZED_END
1013
1014
1015   /* Shift the error token.  */
1016@@ -2259,8 +2195,7 @@
1017 }
1018
1019
1020-
1021-/* Line 2071 of yacc.c  */
1022+/* Line 2050 of yacc.c  */
1023 #line 264 "calc.y"
1024
1025
1026@@ -2317,4 +2252,3 @@
1027
1028   return yyparse ();
1029 }
1030-
1031diff -rNU3 dist.orig/demos/calc/calc.h dist.nbsd/demos/calc/calc.h
1032--- dist.orig/demos/calc/calc.h	Mon May 20 15:00:17 2013
1033+++ dist.nbsd/demos/calc/calc.h	Wed Feb 19 16:34:37 2014
1034@@ -1,8 +1,8 @@
1035-/* A Bison parser, made by GNU Bison 2.5.1.  */
1036+/* A Bison parser, made by GNU Bison 2.7.12-4996.  */
1037
1038 /* Bison interface for Yacc-like parsers in C
1039
1040-      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
1041+      Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1042
1043    This program is free software: you can redistribute it and/or modify
1044    it under the terms of the GNU General Public License as published by
1045@@ -30,6 +30,15 @@
1046    This special exception was added by the Free Software Foundation in
1047    version 2.2 of Bison.  */
1048
1049+#ifndef YY_YY_CALC_H_INCLUDED
1050+# define YY_YY_CALC_H_INCLUDED
1051+/* Enabling traces.  */
1052+#ifndef YYDEBUG
1053+# define YYDEBUG 0
1054+#endif
1055+#if YYDEBUG
1056+extern int yydebug;
1057+#endif
1058
1059 /* Tokens.  */
1060 #ifndef YYTOKENTYPE
1061@@ -99,21 +108,18 @@
1062
1063
1064
1065-
1066 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1067 typedef union YYSTYPE
1068 {
1069-
1070-/* Line 2072 of yacc.c  */
1071+/* Line 2053 of yacc.c  */
1072 #line 142 "calc.y"
1073
1074   char  *str;
1075   int   var;
1076
1077
1078-
1079-/* Line 2072 of yacc.c  */
1080-#line 117 "calc.h"
1081+/* Line 2053 of yacc.c  */
1082+#line 123 "calc.h"
1083 } YYSTYPE;
1084 # define YYSTYPE_IS_TRIVIAL 1
1085 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1086@@ -122,4 +128,18 @@
1087
1088 extern YYSTYPE yylval;
1089
1090+#ifdef YYPARSE_PARAM
1091+#if defined __STDC__ || defined __cplusplus
1092+int yyparse (void *YYPARSE_PARAM);
1093+#else
1094+int yyparse ();
1095+#endif
1096+#else /* ! YYPARSE_PARAM */
1097+#if defined __STDC__ || defined __cplusplus
1098+int yyparse (void);
1099+#else
1100+int yyparse ();
1101+#endif
1102+#endif /* ! YYPARSE_PARAM */
1103
1104+#endif /* !YY_YY_CALC_H_INCLUDED  */
1105Binary files dist.orig/doc/gmp.info and dist.nbsd/doc/gmp.info differ
1106Binary files dist.orig/doc/gmp.info-1 and dist.nbsd/doc/gmp.info-1 differ
1107Binary files dist.orig/doc/gmp.info-2 and dist.nbsd/doc/gmp.info-2 differ
1108diff -rNU3 dist.orig/doc/gmp.texi dist.nbsd/doc/gmp.texi
1109--- dist.orig/doc/gmp.texi	Mon May 20 14:59:56 2013
1110+++ dist.nbsd/doc/gmp.texi	Wed Feb 19 16:34:37 2014
1111@@ -713,7 +713,7 @@
1112 other members, older or newer.  The best idea is always to build GMP for the
1113 exact machine type you intend to run it on.
1114
1115-The following CPUs have specific support.  See @file{configure.in} for details
1116+The following CPUs have specific support.  See @file{configure.ac} for details
1117 of what code and compiler options they select.
1118
1119 @itemize @bullet
1120@@ -2647,19 +2647,20 @@
1121
1122 @item Valgrind
1123 @cindex Valgrind
1124-The valgrind program (@uref{http://valgrind.org/}) is a memory
1125-checker for x86s.  It translates and emulates machine instructions to do
1126+Valgrind (@uref{http://valgrind.org/}) is a memory checker for x86, ARM, MIPS,
1127+PowerPC, and S/390.  It translates and emulates machine instructions to do
1128 strong checks for uninitialized data (at the level of individual bits), memory
1129 accesses through bad pointers, and memory leaks.
1130
1131-Recent versions of Valgrind are getting support for MMX and SSE/SSE2
1132-instructions, for past versions GMP will need to be configured not to use
1133-those, i.e.@: for an x86 without them (for instance plain @samp{i486}).
1134+Valgrind does not always support every possible instruction, in particular
1135+ones recently added to an ISA.  Valgrind might therefore be incompatible with
1136+a recent GMP or even a less recent GMP which is compiled using a recent GCC.
1137
1138 GMP's assembly code sometimes promotes a read of the limbs to some larger size,
1139 for efficiency.  GMP will do this even at the start and end of a multilimb
1140-operand, using naturaly aligned operations on the larger type.  This may lead
1141-to benign reads outside of allocated areas, triggering complants from Valgrind.
1142+operand, using naturally aligned operations on the larger type.  This may lead
1143+to benign reads outside of allocated areas, triggering complaints from
1144+Valgrind.  Valgrind's option @samp{--partial-loads-ok=yes} should help.
1145
1146 @item Other Problems
1147 Any suspected bug in GMP itself should be isolated to make sure it's not an
1148@@ -2882,9 +2883,12 @@
1149 Please do not send core dumps, executables or @command{strace}s.
1150
1151 @item
1152-The configuration options you used when building GMP, if any.
1153+The @samp{configure} options you used when building GMP, if any.
1154
1155 @item
1156+The output from @samp{configure}, as printed to stdout, with any options used.
1157+
1158+@item
1159 The name of the compiler and its version.  For @command{gcc}, get the version
1160 with @samp{gcc -v}, otherwise perhaps @samp{what `which cc`}, or similar.
1161
1162@@ -3030,19 +3034,19 @@
1163 These functions assign new values to already initialized integers
1164 (@pxref{Initializing Integers}).
1165
1166-@deftypefun void mpz_set (mpz_t @var{rop}, mpz_t @var{op})
1167+@deftypefun void mpz_set (mpz_t @var{rop}, const mpz_t @var{op})
1168 @deftypefunx void mpz_set_ui (mpz_t @var{rop}, unsigned long int @var{op})
1169 @deftypefunx void mpz_set_si (mpz_t @var{rop}, signed long int @var{op})
1170 @deftypefunx void mpz_set_d (mpz_t @var{rop}, double @var{op})
1171-@deftypefunx void mpz_set_q (mpz_t @var{rop}, mpq_t @var{op})
1172-@deftypefunx void mpz_set_f (mpz_t @var{rop}, mpf_t @var{op})
1173+@deftypefunx void mpz_set_q (mpz_t @var{rop}, const mpq_t @var{op})
1174+@deftypefunx void mpz_set_f (mpz_t @var{rop}, const mpf_t @var{op})
1175 Set the value of @var{rop} from @var{op}.
1176
1177 @code{mpz_set_d}, @code{mpz_set_q} and @code{mpz_set_f} truncate @var{op} to
1178 make it an integer.
1179 @end deftypefun
1180
1181-@deftypefun int mpz_set_str (mpz_t @var{rop}, char *@var{str}, int @var{base})
1182+@deftypefun int mpz_set_str (mpz_t @var{rop}, const char *@var{str}, int @var{base})
1183 Set the value of @var{rop} from @var{str}, a null-terminated C string in base
1184 @var{base}.  White space is allowed in the string, and is simply ignored.
1185
1186@@ -3101,7 +3105,7 @@
1187 integer functions.  Don't use an initialize-and-set function on a variable
1188 already initialized!
1189
1190-@deftypefun void mpz_init_set (mpz_t @var{rop}, mpz_t @var{op})
1191+@deftypefun void mpz_init_set (mpz_t @var{rop}, const mpz_t @var{op})
1192 @deftypefunx void mpz_init_set_ui (mpz_t @var{rop}, unsigned long int @var{op})
1193 @deftypefunx void mpz_init_set_si (mpz_t @var{rop}, signed long int @var{op})
1194 @deftypefunx void mpz_init_set_d (mpz_t @var{rop}, double @var{op})
1195@@ -3109,7 +3113,7 @@
1196 @var{op}.
1197 @end deftypefun
1198
1199-@deftypefun int mpz_init_set_str (mpz_t @var{rop}, char *@var{str}, int @var{base})
1200+@deftypefun int mpz_init_set_str (mpz_t @var{rop}, const char *@var{str}, int @var{base})
1201 Initialize @var{rop} and set its value like @code{mpz_set_str} (see its
1202 documentation above for details).
1203
1204@@ -3129,7 +3133,7 @@
1205 types.  Functions for converting @emph{to} GMP integers are described in
1206 @ref{Assigning Integers} and @ref{I/O of Integers}.
1207
1208-@deftypefun {unsigned long int} mpz_get_ui (mpz_t @var{op})
1209+@deftypefun {unsigned long int} mpz_get_ui (const mpz_t @var{op})
1210 Return the value of @var{op} as an @code{unsigned long}.
1211
1212 If @var{op} is too big to fit an @code{unsigned long} then just the least
1213@@ -3137,7 +3141,7 @@
1214 only the absolute value is used.
1215 @end deftypefun
1216
1217-@deftypefun {signed long int} mpz_get_si (mpz_t @var{op})
1218+@deftypefun {signed long int} mpz_get_si (const mpz_t @var{op})
1219 If @var{op} fits into a @code{signed long int} return the value of @var{op}.
1220 Otherwise return the least significant part of @var{op}, with the same sign
1221 as @var{op}.
1222@@ -3147,7 +3151,7 @@
1223 the function @code{mpz_fits_slong_p}.
1224 @end deftypefun
1225
1226-@deftypefun double mpz_get_d (mpz_t @var{op})
1227+@deftypefun double mpz_get_d (const mpz_t @var{op})
1228 Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
1229 towards zero).
1230
1231@@ -3156,7 +3160,7 @@
1232 may or may not occur.
1233 @end deftypefun
1234
1235-@deftypefun double mpz_get_d_2exp (signed long int *@var{exp}, mpz_t @var{op})
1236+@deftypefun double mpz_get_d_2exp (signed long int *@var{exp}, const mpz_t @var{op})
1237 Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
1238 towards zero), and returning the exponent separately.
1239
1240@@ -3170,7 +3174,7 @@
1241 Functions,,, libc, The GNU C Library Reference Manual}).
1242 @end deftypefun
1243
1244-@deftypefun {char *} mpz_get_str (char *@var{str}, int @var{base}, mpz_t @var{op})
1245+@deftypefun {char *} mpz_get_str (char *@var{str}, int @var{base}, const mpz_t @var{op})
1246 Convert @var{op} to a string of digits in base @var{base}.  The base argument
1247 may vary from 2 to 62 or from @minus{}2 to @minus{}36.
1248
1249@@ -3201,45 +3205,45 @@
1250 @cindex Integer arithmetic functions
1251 @cindex Arithmetic functions
1252
1253-@deftypefun void mpz_add (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1254-@deftypefunx void mpz_add_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
1255+@deftypefun void mpz_add (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1256+@deftypefunx void mpz_add_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
1257 Set @var{rop} to @math{@var{op1} + @var{op2}}.
1258 @end deftypefun
1259
1260-@deftypefun void mpz_sub (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1261-@deftypefunx void mpz_sub_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
1262-@deftypefunx void mpz_ui_sub (mpz_t @var{rop}, unsigned long int @var{op1}, mpz_t @var{op2})
1263+@deftypefun void mpz_sub (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1264+@deftypefunx void mpz_sub_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
1265+@deftypefunx void mpz_ui_sub (mpz_t @var{rop}, unsigned long int @var{op1}, const mpz_t @var{op2})
1266 Set @var{rop} to @var{op1} @minus{} @var{op2}.
1267 @end deftypefun
1268
1269-@deftypefun void mpz_mul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1270-@deftypefunx void mpz_mul_si (mpz_t @var{rop}, mpz_t @var{op1}, long int @var{op2})
1271-@deftypefunx void mpz_mul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
1272+@deftypefun void mpz_mul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1273+@deftypefunx void mpz_mul_si (mpz_t @var{rop}, const mpz_t @var{op1}, long int @var{op2})
1274+@deftypefunx void mpz_mul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
1275 Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}}.
1276 @end deftypefun
1277
1278-@deftypefun void mpz_addmul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1279-@deftypefunx void mpz_addmul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
1280+@deftypefun void mpz_addmul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1281+@deftypefunx void mpz_addmul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
1282 Set @var{rop} to @math{@var{rop} + @var{op1} @GMPtimes{} @var{op2}}.
1283 @end deftypefun
1284
1285-@deftypefun void mpz_submul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1286-@deftypefunx void mpz_submul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
1287+@deftypefun void mpz_submul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1288+@deftypefunx void mpz_submul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
1289 Set @var{rop} to @math{@var{rop} - @var{op1} @GMPtimes{} @var{op2}}.
1290 @end deftypefun
1291
1292-@deftypefun void mpz_mul_2exp (mpz_t @var{rop}, mpz_t @var{op1}, mp_bitcnt_t @var{op2})
1293+@deftypefun void mpz_mul_2exp (mpz_t @var{rop}, const mpz_t @var{op1}, mp_bitcnt_t @var{op2})
1294 @cindex Bit shift left
1295 Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
1296 @var{op2}}.  This operation can also be defined as a left shift by @var{op2}
1297 bits.
1298 @end deftypefun
1299
1300-@deftypefun void mpz_neg (mpz_t @var{rop}, mpz_t @var{op})
1301+@deftypefun void mpz_neg (mpz_t @var{rop}, const mpz_t @var{op})
1302 Set @var{rop} to @minus{}@var{op}.
1303 @end deftypefun
1304
1305-@deftypefun void mpz_abs (mpz_t @var{rop}, mpz_t @var{op})
1306+@deftypefun void mpz_abs (mpz_t @var{rop}, const mpz_t @var{op})
1307 Set @var{rop} to the absolute value of @var{op}.
1308 @end deftypefun
1309
1310@@ -3260,43 +3264,43 @@
1311 @c  between each, and seem to let tex do a better job of page breaks than an
1312 @c  @sp 1 in the middle of one big set.
1313
1314-@deftypefun void mpz_cdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
1315-@deftypefunx void mpz_cdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1316-@deftypefunx void mpz_cdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1317+@deftypefun void mpz_cdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
1318+@deftypefunx void mpz_cdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1319+@deftypefunx void mpz_cdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1320 @maybepagebreak
1321-@deftypefunx {unsigned long int} mpz_cdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1322-@deftypefunx {unsigned long int} mpz_cdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1323-@deftypefunx {unsigned long int} mpz_cdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
1324-@deftypefunx {unsigned long int} mpz_cdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
1325+@deftypefunx {unsigned long int} mpz_cdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1326+@deftypefunx {unsigned long int} mpz_cdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1327+@deftypefunx {unsigned long int} mpz_cdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
1328+@deftypefunx {unsigned long int} mpz_cdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
1329 @maybepagebreak
1330-@deftypefunx void mpz_cdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1331-@deftypefunx void mpz_cdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1332+@deftypefunx void mpz_cdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1333+@deftypefunx void mpz_cdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1334 @end deftypefun
1335
1336-@deftypefun void mpz_fdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
1337-@deftypefunx void mpz_fdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1338-@deftypefunx void mpz_fdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1339+@deftypefun void mpz_fdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
1340+@deftypefunx void mpz_fdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1341+@deftypefunx void mpz_fdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1342 @maybepagebreak
1343-@deftypefunx {unsigned long int} mpz_fdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1344-@deftypefunx {unsigned long int} mpz_fdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1345-@deftypefunx {unsigned long int} mpz_fdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
1346-@deftypefunx {unsigned long int} mpz_fdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
1347+@deftypefunx {unsigned long int} mpz_fdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1348+@deftypefunx {unsigned long int} mpz_fdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1349+@deftypefunx {unsigned long int} mpz_fdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
1350+@deftypefunx {unsigned long int} mpz_fdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
1351 @maybepagebreak
1352-@deftypefunx void mpz_fdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1353-@deftypefunx void mpz_fdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1354+@deftypefunx void mpz_fdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1355+@deftypefunx void mpz_fdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1356 @end deftypefun
1357
1358-@deftypefun void mpz_tdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
1359-@deftypefunx void mpz_tdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1360-@deftypefunx void mpz_tdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1361+@deftypefun void mpz_tdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
1362+@deftypefunx void mpz_tdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1363+@deftypefunx void mpz_tdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1364 @maybepagebreak
1365-@deftypefunx {unsigned long int} mpz_tdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1366-@deftypefunx {unsigned long int} mpz_tdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1367-@deftypefunx {unsigned long int} mpz_tdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
1368-@deftypefunx {unsigned long int} mpz_tdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
1369+@deftypefunx {unsigned long int} mpz_tdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1370+@deftypefunx {unsigned long int} mpz_tdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1371+@deftypefunx {unsigned long int} mpz_tdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
1372+@deftypefunx {unsigned long int} mpz_tdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
1373 @maybepagebreak
1374-@deftypefunx void mpz_tdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1375-@deftypefunx void mpz_tdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1376+@deftypefunx void mpz_tdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1377+@deftypefunx void mpz_tdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
1378 @cindex Bit shift right
1379
1380 @sp 1
1381@@ -3344,8 +3348,8 @@
1382 effectively treats @var{n} as sign and magnitude.
1383 @end deftypefun
1384
1385-@deftypefun void mpz_mod (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
1386-@deftypefunx {unsigned long int} mpz_mod_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
1387+@deftypefun void mpz_mod (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
1388+@deftypefunx {unsigned long int} mpz_mod_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
1389 Set @var{r} to @var{n} @code{mod} @var{d}.  The sign of the divisor is
1390 ignored; the result is always non-negative.
1391
1392@@ -3354,8 +3358,8 @@
1393 the return value is wanted.
1394 @end deftypefun
1395
1396-@deftypefun void mpz_divexact (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
1397-@deftypefunx void mpz_divexact_ui (mpz_t @var{q}, mpz_t @var{n}, unsigned long @var{d})
1398+@deftypefun void mpz_divexact (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
1399+@deftypefunx void mpz_divexact_ui (mpz_t @var{q}, const mpz_t @var{n}, unsigned long @var{d})
1400 @cindex Exact division functions
1401 Set @var{q} to @var{n}/@var{d}.  These functions produce correct results only
1402 when it is known in advance that @var{d} divides @var{n}.
1403@@ -3365,9 +3369,9 @@
1404 rational to lowest terms.
1405 @end deftypefun
1406
1407-@deftypefun int mpz_divisible_p (mpz_t @var{n}, mpz_t @var{d})
1408-@deftypefunx int mpz_divisible_ui_p (mpz_t @var{n}, unsigned long int @var{d})
1409-@deftypefunx int mpz_divisible_2exp_p (mpz_t @var{n}, mp_bitcnt_t @var{b})
1410+@deftypefun int mpz_divisible_p (const mpz_t @var{n}, const mpz_t @var{d})
1411+@deftypefunx int mpz_divisible_ui_p (const mpz_t @var{n}, unsigned long int @var{d})
1412+@deftypefunx int mpz_divisible_2exp_p (const mpz_t @var{n}, mp_bitcnt_t @var{b})
1413 @cindex Divisibility functions
1414 Return non-zero if @var{n} is exactly divisible by @var{d}, or in the case of
1415 @code{mpz_divisible_2exp_p} by @m{2^b,2^@var{b}}.
1416@@ -3378,9 +3382,9 @@
1417 that only 0 is considered divisible by 0.
1418 @end deftypefun
1419
1420-@deftypefun int mpz_congruent_p (mpz_t @var{n}, mpz_t @var{c}, mpz_t @var{d})
1421-@deftypefunx int mpz_congruent_ui_p (mpz_t @var{n}, unsigned long int @var{c}, unsigned long int @var{d})
1422-@deftypefunx int mpz_congruent_2exp_p (mpz_t @var{n}, mpz_t @var{c}, mp_bitcnt_t @var{b})
1423+@deftypefun int mpz_congruent_p (const mpz_t @var{n}, const mpz_t @var{c}, const mpz_t @var{d})
1424+@deftypefunx int mpz_congruent_ui_p (const mpz_t @var{n}, unsigned long int @var{c}, unsigned long int @var{d})
1425+@deftypefunx int mpz_congruent_2exp_p (const mpz_t @var{n}, const mpz_t @var{c}, mp_bitcnt_t @var{b})
1426 @cindex Divisibility functions
1427 @cindex Congruence functions
1428 Return non-zero if @var{n} is congruent to @var{c} modulo @var{d}, or in the
1429@@ -3401,8 +3405,8 @@
1430 @cindex Exponentiation functions
1431 @cindex Powering functions
1432
1433-@deftypefun void mpz_powm (mpz_t @var{rop}, mpz_t @var{base}, mpz_t @var{exp}, mpz_t @var{mod})
1434-@deftypefunx void mpz_powm_ui (mpz_t @var{rop}, mpz_t @var{base}, unsigned long int @var{exp}, mpz_t @var{mod})
1435+@deftypefun void mpz_powm (mpz_t @var{rop}, const mpz_t @var{base}, const mpz_t @var{exp}, const mpz_t @var{mod})
1436+@deftypefunx void mpz_powm_ui (mpz_t @var{rop}, const mpz_t @var{base}, unsigned long int @var{exp}, const mpz_t @var{mod})
1437 Set @var{rop} to @m{base^{exp} \bmod mod, (@var{base} raised to @var{exp})
1438 modulo @var{mod}}.
1439
1440@@ -3411,7 +3415,7 @@
1441 If an inverse doesn't exist then a divide by zero is raised.
1442 @end deftypefun
1443
1444-@deftypefun void mpz_powm_sec (mpz_t @var{rop}, mpz_t @var{base}, mpz_t @var{exp}, mpz_t @var{mod})
1445+@deftypefun void mpz_powm_sec (mpz_t @var{rop}, const mpz_t @var{base}, const mpz_t @var{exp}, const mpz_t @var{mod})
1446 Set @var{rop} to @m{base^{exp} \bmod mod, (@var{base} raised to @var{exp})
1447 modulo @var{mod}}.
1448
1449@@ -3424,7 +3428,7 @@
1450 resilience to side-channel attacks is desired.
1451 @end deftypefun
1452
1453-@deftypefun void mpz_pow_ui (mpz_t @var{rop}, mpz_t @var{base}, unsigned long int @var{exp})
1454+@deftypefun void mpz_pow_ui (mpz_t @var{rop}, const mpz_t @var{base}, unsigned long int @var{exp})
1455 @deftypefunx void mpz_ui_pow_ui (mpz_t @var{rop}, unsigned long int @var{base}, unsigned long int @var{exp})
1456 Set @var{rop} to @m{base^{exp}, @var{base} raised to @var{exp}}.  The case
1457 @math{0^0} yields 1.
1458@@ -3437,25 +3441,25 @@
1459 @cindex Integer root functions
1460 @cindex Root extraction functions
1461
1462-@deftypefun int mpz_root (mpz_t @var{rop}, mpz_t @var{op}, unsigned long int @var{n})
1463+@deftypefun int mpz_root (mpz_t @var{rop}, const mpz_t @var{op}, unsigned long int @var{n})
1464 Set @var{rop} to @m{\lfloor\root n \of {op}\rfloor@C{},} the truncated integer
1465 part of the @var{n}th root of @var{op}.  Return non-zero if the computation
1466 was exact, i.e., if @var{op} is @var{rop} to the @var{n}th power.
1467 @end deftypefun
1468
1469-@deftypefun void mpz_rootrem (mpz_t @var{root}, mpz_t @var{rem}, mpz_t @var{u}, unsigned long int @var{n})
1470+@deftypefun void mpz_rootrem (mpz_t @var{root}, mpz_t @var{rem}, const mpz_t @var{u}, unsigned long int @var{n})
1471 Set @var{root} to @m{\lfloor\root n \of {u}\rfloor@C{},} the truncated
1472 integer part of the @var{n}th root of @var{u}.  Set @var{rem} to the
1473 remainder, @m{(@var{u} - @var{root}^n),
1474 @var{u}@minus{}@var{root}**@var{n}}.
1475 @end deftypefun
1476
1477-@deftypefun void mpz_sqrt (mpz_t @var{rop}, mpz_t @var{op})
1478+@deftypefun void mpz_sqrt (mpz_t @var{rop}, const mpz_t @var{op})
1479 Set @var{rop} to @m{\lfloor\sqrt{@var{op}}\rfloor@C{},} the truncated
1480 integer part of the square root of @var{op}.
1481 @end deftypefun
1482
1483-@deftypefun void mpz_sqrtrem (mpz_t @var{rop1}, mpz_t @var{rop2}, mpz_t @var{op})
1484+@deftypefun void mpz_sqrtrem (mpz_t @var{rop1}, mpz_t @var{rop2}, const mpz_t @var{op})
1485 Set @var{rop1} to @m{\lfloor\sqrt{@var{op}}\rfloor, the truncated integer part
1486 of the square root of @var{op}}, like @code{mpz_sqrt}.  Set @var{rop2} to the
1487 remainder @m{(@var{op} - @var{rop1}^2),
1488@@ -3466,7 +3470,7 @@
1489 undefined.
1490 @end deftypefun
1491
1492-@deftypefun int mpz_perfect_power_p (mpz_t @var{op})
1493+@deftypefun int mpz_perfect_power_p (const mpz_t @var{op})
1494 @cindex Perfect power functions
1495 @cindex Root testing functions
1496 Return non-zero if @var{op} is a perfect power, i.e., if there exist integers
1497@@ -3478,7 +3482,7 @@
1498 perfect powers.
1499 @end deftypefun
1500
1501-@deftypefun int mpz_perfect_square_p (mpz_t @var{op})
1502+@deftypefun int mpz_perfect_square_p (const mpz_t @var{op})
1503 @cindex Perfect square functions
1504 @cindex Root testing functions
1505 Return non-zero if @var{op} is a perfect square, i.e., if the square root of
1506@@ -3492,7 +3496,7 @@
1507 @section Number Theoretic Functions
1508 @cindex Number theoretic functions
1509
1510-@deftypefun int mpz_probab_prime_p (mpz_t @var{n}, int @var{reps})
1511+@deftypefun int mpz_probab_prime_p (const mpz_t @var{n}, int @var{reps})
1512 @cindex Prime testing functions
1513 @cindex Probable prime testing functions
1514 Determine whether @var{n} is prime.  Return 2 if @var{n} is definitely prime,
1515@@ -3511,7 +3515,7 @@
1516 which pass are considered probably prime.
1517 @end deftypefun
1518
1519-@deftypefun void mpz_nextprime (mpz_t @var{rop}, mpz_t @var{op})
1520+@deftypefun void mpz_nextprime (mpz_t @var{rop}, const mpz_t @var{op})
1521 @cindex Next prime function
1522 Set @var{rop} to the next prime greater than @var{op}.
1523
1524@@ -3522,7 +3526,7 @@
1525
1526 @c mpz_prime_p not implemented as of gmp 3.0.
1527
1528-@c @deftypefun int mpz_prime_p (mpz_t @var{n})
1529+@c @deftypefun int mpz_prime_p (const mpz_t @var{n})
1530 @c Return non-zero if @var{n} is prime and zero if @var{n} is a non-prime.
1531 @c This function is far slower than @code{mpz_probab_prime_p}, but then it
1532 @c never returns non-zero for composite numbers.
1533@@ -3533,7 +3537,7 @@
1534 @c prime, if the @var{reps} argument is in the suggested range.)
1535 @c @end deftypefun
1536
1537-@deftypefun void mpz_gcd (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1538+@deftypefun void mpz_gcd (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1539 @cindex Greatest common divisor functions
1540 @cindex GCD functions
1541 Set @var{rop} to the greatest common divisor of @var{op1} and @var{op2}.  The
1542@@ -3541,7 +3545,7 @@
1543 Except if both inputs are zero; then this function defines @math{gcd(0,0) = 0}.
1544 @end deftypefun
1545
1546-@deftypefun {unsigned long int} mpz_gcd_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
1547+@deftypefun {unsigned long int} mpz_gcd_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
1548 Compute the greatest common divisor of @var{op1} and @var{op2}.  If
1549 @var{rop} is not @code{NULL}, store the result there.
1550
1551@@ -3551,7 +3555,7 @@
1552 is non-zero.
1553 @end deftypefun
1554
1555-@deftypefun void mpz_gcdext (mpz_t @var{g}, mpz_t @var{s}, mpz_t @var{t}, mpz_t @var{a}, mpz_t @var{b})
1556+@deftypefun void mpz_gcdext (mpz_t @var{g}, mpz_t @var{s}, mpz_t @var{t}, const mpz_t @var{a}, const mpz_t @var{b})
1557 @cindex Extended GCD
1558 @cindex GCD extended
1559 Set @var{g} to the greatest common divisor of @var{a} and @var{b}, and in
1560@@ -3578,8 +3582,8 @@
1561 If @var{t} is @code{NULL} then that value is not computed.
1562 @end deftypefun
1563
1564-@deftypefun void mpz_lcm (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1565-@deftypefunx void mpz_lcm_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long @var{op2})
1566+@deftypefun void mpz_lcm (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1567+@deftypefunx void mpz_lcm_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long @var{op2})
1568 @cindex Least common multiple functions
1569 @cindex LCM functions
1570 Set @var{rop} to the least common multiple of @var{op1} and @var{op2}.
1571@@ -3587,7 +3591,7 @@
1572 @var{op2}.  @var{rop} will be zero if either @var{op1} or @var{op2} is zero.
1573 @end deftypefun
1574
1575-@deftypefun int mpz_invert (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1576+@deftypefun int mpz_invert (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1577 @cindex Modular inverse functions
1578 @cindex Inverse modulo functions
1579 Compute the inverse of @var{op1} modulo @var{op2} and put the result in
1580@@ -3597,24 +3601,24 @@
1581 this function is undefined when @var{op2} is zero.
1582 @end deftypefun
1583
1584-@deftypefun int mpz_jacobi (mpz_t @var{a}, mpz_t @var{b})
1585+@deftypefun int mpz_jacobi (const mpz_t @var{a}, const mpz_t @var{b})
1586 @cindex Jacobi symbol functions
1587 Calculate the Jacobi symbol @m{\left(a \over b\right),
1588 (@var{a}/@var{b})}.  This is defined only for @var{b} odd.
1589 @end deftypefun
1590
1591-@deftypefun int mpz_legendre (mpz_t @var{a}, mpz_t @var{p})
1592+@deftypefun int mpz_legendre (const mpz_t @var{a}, const mpz_t @var{p})
1593 @cindex Legendre symbol functions
1594 Calculate the Legendre symbol @m{\left(a \over p\right),
1595 (@var{a}/@var{p})}.  This is defined only for @var{p} an odd positive
1596 prime, and for such @var{p} it's identical to the Jacobi symbol.
1597 @end deftypefun
1598
1599-@deftypefun int mpz_kronecker (mpz_t @var{a}, mpz_t @var{b})
1600-@deftypefunx int mpz_kronecker_si (mpz_t @var{a}, long @var{b})
1601-@deftypefunx int mpz_kronecker_ui (mpz_t @var{a}, unsigned long @var{b})
1602-@deftypefunx int mpz_si_kronecker (long @var{a}, mpz_t @var{b})
1603-@deftypefunx int mpz_ui_kronecker (unsigned long @var{a}, mpz_t @var{b})
1604+@deftypefun int mpz_kronecker (const mpz_t @var{a}, const mpz_t @var{b})
1605+@deftypefunx int mpz_kronecker_si (const mpz_t @var{a}, long @var{b})
1606+@deftypefunx int mpz_kronecker_ui (const mpz_t @var{a}, unsigned long @var{b})
1607+@deftypefunx int mpz_si_kronecker (long @var{a}, const mpz_t @var{b})
1608+@deftypefunx int mpz_ui_kronecker (unsigned long @var{a}, const mpz_t @var{b})
1609 @cindex Kronecker symbol functions
1610 Calculate the Jacobi symbol @m{\left(a \over b\right),
1611 (@var{a}/@var{b})} with the Kronecker extension @m{\left(a \over
1612@@ -3630,7 +3634,7 @@
1613 @file{demos/qcn.c} which uses @code{mpz_kronecker_ui}.
1614 @end deftypefun
1615
1616-@deftypefun {mp_bitcnt_t} mpz_remove (mpz_t @var{rop}, mpz_t @var{op}, mpz_t @var{f})
1617+@deftypefun {mp_bitcnt_t} mpz_remove (mpz_t @var{rop}, const mpz_t @var{op}, const mpz_t @var{f})
1618 @cindex Remove factor functions
1619 @cindex Factor removal functions
1620 Remove all occurrences of the factor @var{f} from @var{op} and store the
1621@@ -3653,7 +3657,7 @@
1622 prime numbers @math{@le{}@var{n}}.
1623 @end deftypefun
1624
1625-@deftypefun void mpz_bin_ui (mpz_t @var{rop}, mpz_t @var{n}, unsigned long int @var{k})
1626+@deftypefun void mpz_bin_ui (mpz_t @var{rop}, const mpz_t @var{n}, unsigned long int @var{k})
1627 @deftypefunx void mpz_bin_uiui (mpz_t @var{rop}, unsigned long int @var{n}, @w{unsigned long int @var{k}})
1628 @cindex Binomial coefficient functions
1629 Compute the binomial coefficient @m{\left({n}\atop{k}\right), @var{n} over
1630@@ -3702,10 +3706,10 @@
1631 @cindex Integer comparison functions
1632 @cindex Comparison functions
1633
1634-@deftypefn Function int mpz_cmp (mpz_t @var{op1}, mpz_t @var{op2})
1635-@deftypefnx Function int mpz_cmp_d (mpz_t @var{op1}, double @var{op2})
1636-@deftypefnx Macro int mpz_cmp_si (mpz_t @var{op1}, signed long int @var{op2})
1637-@deftypefnx Macro int mpz_cmp_ui (mpz_t @var{op1}, unsigned long int @var{op2})
1638+@deftypefn Function int mpz_cmp (const mpz_t @var{op1}, const mpz_t @var{op2})
1639+@deftypefnx Function int mpz_cmp_d (const mpz_t @var{op1}, double @var{op2})
1640+@deftypefnx Macro int mpz_cmp_si (const mpz_t @var{op1}, signed long int @var{op2})
1641+@deftypefnx Macro int mpz_cmp_ui (const mpz_t @var{op1}, unsigned long int @var{op2})
1642 Compare @var{op1} and @var{op2}.  Return a positive value if @math{@var{op1} >
1643 @var{op2}}, zero if @math{@var{op1} = @var{op2}}, or a negative value if
1644 @math{@var{op1} < @var{op2}}.
1645@@ -3715,9 +3719,9 @@
1646 but results are undefined for a NaN.
1647 @end deftypefn
1648
1649-@deftypefn Function int mpz_cmpabs (mpz_t @var{op1}, mpz_t @var{op2})
1650-@deftypefnx Function int mpz_cmpabs_d (mpz_t @var{op1}, double @var{op2})
1651-@deftypefnx Function int mpz_cmpabs_ui (mpz_t @var{op1}, unsigned long int @var{op2})
1652+@deftypefn Function int mpz_cmpabs (const mpz_t @var{op1}, const mpz_t @var{op2})
1653+@deftypefnx Function int mpz_cmpabs_d (const mpz_t @var{op1}, double @var{op2})
1654+@deftypefnx Function int mpz_cmpabs_ui (const mpz_t @var{op1}, unsigned long int @var{op2})
1655 Compare the absolute values of @var{op1} and @var{op2}.  Return a positive
1656 value if @math{@GMPabs{@var{op1}} > @GMPabs{@var{op2}}}, zero if
1657 @math{@GMPabs{@var{op1}} = @GMPabs{@var{op2}}}, or a negative value if
1658@@ -3727,7 +3731,7 @@
1659 for a NaN.
1660 @end deftypefn
1661
1662-@deftypefn Macro int mpz_sgn (mpz_t @var{op})
1663+@deftypefn Macro int mpz_sgn (const mpz_t @var{op})
1664 @cindex Sign tests
1665 @cindex Integer sign tests
1666 Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
1667@@ -3750,30 +3754,30 @@
1668 sign-magnitude is the actual implementation).  The least significant bit is
1669 number 0.
1670
1671-@deftypefun void mpz_and (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1672+@deftypefun void mpz_and (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1673 Set @var{rop} to @var{op1} bitwise-and @var{op2}.
1674 @end deftypefun
1675
1676-@deftypefun void mpz_ior (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1677+@deftypefun void mpz_ior (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1678 Set @var{rop} to @var{op1} bitwise inclusive-or @var{op2}.
1679 @end deftypefun
1680
1681-@deftypefun void mpz_xor (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
1682+@deftypefun void mpz_xor (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
1683 Set @var{rop} to @var{op1} bitwise exclusive-or @var{op2}.
1684 @end deftypefun
1685
1686-@deftypefun void mpz_com (mpz_t @var{rop}, mpz_t @var{op})
1687+@deftypefun void mpz_com (mpz_t @var{rop}, const mpz_t @var{op})
1688 Set @var{rop} to the one's complement of @var{op}.
1689 @end deftypefun
1690
1691-@deftypefun {mp_bitcnt_t} mpz_popcount (mpz_t @var{op})
1692+@deftypefun {mp_bitcnt_t} mpz_popcount (const mpz_t @var{op})
1693 If @math{@var{op}@ge{}0}, return the population count of @var{op}, which is the
1694 number of 1 bits in the binary representation.  If @math{@var{op}<0}, the
1695 number of 1s is infinite, and the return value is the largest possible
1696 @code{mp_bitcnt_t}.
1697 @end deftypefun
1698
1699-@deftypefun {mp_bitcnt_t} mpz_hamdist (mpz_t @var{op1}, mpz_t @var{op2})
1700+@deftypefun {mp_bitcnt_t} mpz_hamdist (const mpz_t @var{op1}, const mpz_t @var{op2})
1701 If @var{op1} and @var{op2} are both @math{@ge{}0} or both @math{<0}, return the
1702 hamming distance between the two operands, which is the number of bit positions
1703 where @var{op1} and @var{op2} have different bit values.  If one operand is
1704@@ -3781,8 +3785,8 @@
1705 infinite, and the return value is the largest possible @code{mp_bitcnt_t}.
1706 @end deftypefun
1707
1708-@deftypefun {mp_bitcnt_t} mpz_scan0 (mpz_t @var{op}, mp_bitcnt_t @var{starting_bit})
1709-@deftypefunx {mp_bitcnt_t} mpz_scan1 (mpz_t @var{op}, mp_bitcnt_t @var{starting_bit})
1710+@deftypefun {mp_bitcnt_t} mpz_scan0 (const mpz_t @var{op}, mp_bitcnt_t @var{starting_bit})
1711+@deftypefunx {mp_bitcnt_t} mpz_scan1 (const mpz_t @var{op}, mp_bitcnt_t @var{starting_bit})
1712 @cindex Bit scanning functions
1713 @cindex Scan bit functions
1714 Scan @var{op}, starting from bit @var{starting_bit}, towards more significant
1715@@ -3809,7 +3813,7 @@
1716 Complement bit @var{bit_index} in @var{rop}.
1717 @end deftypefun
1718
1719-@deftypefun int mpz_tstbit (mpz_t @var{op}, mp_bitcnt_t @var{bit_index})
1720+@deftypefun int mpz_tstbit (const mpz_t @var{op}, mp_bitcnt_t @var{bit_index})
1721 Test bit @var{bit_index} in @var{op} and return 0 or 1 accordingly.
1722 @end deftypefun
1723
1724@@ -3832,7 +3836,7 @@
1725
1726 See also @ref{Formatted Output} and @ref{Formatted Input}.
1727
1728-@deftypefun size_t mpz_out_str (FILE *@var{stream}, int @var{base}, mpz_t @var{op})
1729+@deftypefun size_t mpz_out_str (FILE *@var{stream}, int @var{base}, const mpz_t @var{op})
1730 Output @var{op} on stdio stream @var{stream}, as a string of digits in base
1731 @var{base}.  The base argument may vary from 2 to 62 or from @minus{}2 to
1732 @minus{}36.
1733@@ -3860,7 +3864,7 @@
1734 Return the number of bytes read, or if an error occurred, return 0.
1735 @end deftypefun
1736
1737-@deftypefun size_t mpz_out_raw (FILE *@var{stream}, mpz_t @var{op})
1738+@deftypefun size_t mpz_out_raw (FILE *@var{stream}, const mpz_t @var{op})
1739 Output @var{op} on stdio stream @var{stream}, in raw binary format.  The
1740 integer is written in a portable format, with 4 bytes of size information, and
1741 that many bytes of limbs.  Both the size and the limbs are written in
1742@@ -3907,7 +3911,7 @@
1743 invoking this function.
1744 @end deftypefun
1745
1746-@deftypefun void mpz_urandomm (mpz_t @var{rop}, gmp_randstate_t @var{state}, mpz_t @var{n})
1747+@deftypefun void mpz_urandomm (mpz_t @var{rop}, gmp_randstate_t @var{state}, const mpz_t @var{n})
1748 Generate a uniform random integer in the range 0 to @math{@var{n}-1},
1749 inclusive.
1750
1751@@ -3990,7 +3994,7 @@
1752 @code{8*sizeof(int)-INT_BIT}.
1753 @end deftypefun
1754
1755-@deftypefun {void *} mpz_export (void *@var{rop}, size_t *@var{countp}, int @var{order}, size_t @var{size}, int @var{endian}, size_t @var{nails}, mpz_t @var{op})
1756+@deftypefun {void *} mpz_export (void *@var{rop}, size_t *@var{countp}, int @var{order}, size_t @var{size}, int @var{endian}, size_t @var{nails}, const mpz_t @var{op})
1757 @cindex Integer export
1758 @cindex Export
1759 Fill @var{rop} with word data from @var{op}.
1760@@ -4041,24 +4045,24 @@
1761 @cindex Miscellaneous integer functions
1762 @cindex Integer miscellaneous functions
1763
1764-@deftypefun int mpz_fits_ulong_p (mpz_t @var{op})
1765-@deftypefunx int mpz_fits_slong_p (mpz_t @var{op})
1766-@deftypefunx int mpz_fits_uint_p (mpz_t @var{op})
1767-@deftypefunx int mpz_fits_sint_p (mpz_t @var{op})
1768-@deftypefunx int mpz_fits_ushort_p (mpz_t @var{op})
1769-@deftypefunx int mpz_fits_sshort_p (mpz_t @var{op})
1770+@deftypefun int mpz_fits_ulong_p (const mpz_t @var{op})
1771+@deftypefunx int mpz_fits_slong_p (const mpz_t @var{op})
1772+@deftypefunx int mpz_fits_uint_p (const mpz_t @var{op})
1773+@deftypefunx int mpz_fits_sint_p (const mpz_t @var{op})
1774+@deftypefunx int mpz_fits_ushort_p (const mpz_t @var{op})
1775+@deftypefunx int mpz_fits_sshort_p (const mpz_t @var{op})
1776 Return non-zero iff the value of @var{op} fits in an @code{unsigned long int},
1777 @code{signed long int}, @code{unsigned int}, @code{signed int}, @code{unsigned
1778 short int}, or @code{signed short int}, respectively.  Otherwise, return zero.
1779 @end deftypefun
1780
1781-@deftypefn Macro int mpz_odd_p (mpz_t @var{op})
1782-@deftypefnx Macro int mpz_even_p (mpz_t @var{op})
1783+@deftypefn Macro int mpz_odd_p (const mpz_t @var{op})
1784+@deftypefnx Macro int mpz_even_p (const mpz_t @var{op})
1785 Determine whether @var{op} is odd or even, respectively.  Return non-zero if
1786 yes, zero if no.  These macros evaluate their argument more than once.
1787 @end deftypefn
1788
1789-@deftypefun size_t mpz_sizeinbase (mpz_t @var{op}, int @var{base})
1790+@deftypefun size_t mpz_sizeinbase (const mpz_t @var{op}, int @var{base})
1791 @cindex Size in digits
1792 @cindex Digits in an integer
1793 Return the size of @var{op} measured in number of digits in the given
1794@@ -4152,7 +4156,7 @@
1795 @code{_mpz_realloc} takes its size in limbs.
1796 @end deftypefun
1797
1798-@deftypefun mp_limb_t mpz_getlimbn (mpz_t @var{op}, mp_size_t @var{n})
1799+@deftypefun mp_limb_t mpz_getlimbn (const mpz_t @var{op}, mp_size_t @var{n})
1800 Return limb number @var{n} from @var{op}.  The sign of @var{op} is ignored,
1801 just the absolute value is used.  The least significant limb is number 0.
1802
1803@@ -4161,7 +4165,7 @@
1804 @code{mpz_size(@var{op})-1}.
1805 @end deftypefun
1806
1807-@deftypefun size_t mpz_size (mpz_t @var{op})
1808+@deftypefun size_t mpz_size (const mpz_t @var{op})
1809 Return the size of @var{op} measured in number of limbs.  If @var{op} is zero,
1810 the returned value will be zero.
1811 @c (@xref{Nomenclature}, for an explanation of the concept @dfn{limb}.)
1812@@ -4230,8 +4234,8 @@
1813 Free the space occupied by a NULL-terminated list of @code{mpq_t} variables.
1814 @end deftypefun
1815
1816-@deftypefun void mpq_set (mpq_t @var{rop}, mpq_t @var{op})
1817-@deftypefunx void mpq_set_z (mpq_t @var{rop}, mpz_t @var{op})
1818+@deftypefun void mpq_set (mpq_t @var{rop}, const mpq_t @var{op})
1819+@deftypefunx void mpq_set_z (mpq_t @var{rop}, const mpz_t @var{op})
1820 Assign @var{rop} from @var{op}.
1821 @end deftypefun
1822
1823@@ -4242,7 +4246,7 @@
1824 @code{mpq_canonicalize} before any operations are performed on @var{rop}.
1825 @end deftypefun
1826
1827-@deftypefun int mpq_set_str (mpq_t @var{rop}, char *@var{str}, int @var{base})
1828+@deftypefun int mpq_set_str (mpq_t @var{rop}, const char *@var{str}, int @var{base})
1829 Set @var{rop} from a null-terminated string @var{str} in the given @var{base}.
1830
1831 The string can be an integer like ``41'' or a fraction like ``41/152''.  The
1832@@ -4274,7 +4278,7 @@
1833 @cindex Rational conversion functions
1834 @cindex Conversion functions
1835
1836-@deftypefun double mpq_get_d (mpq_t @var{op})
1837+@deftypefun double mpq_get_d (const mpq_t @var{op})
1838 Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
1839 towards zero).
1840
1841@@ -4285,12 +4289,12 @@
1842 @end deftypefun
1843
1844 @deftypefun void mpq_set_d (mpq_t @var{rop}, double @var{op})
1845-@deftypefunx void mpq_set_f (mpq_t @var{rop}, mpf_t @var{op})
1846+@deftypefunx void mpq_set_f (mpq_t @var{rop}, const mpf_t @var{op})
1847 Set @var{rop} to the value of @var{op}.  There is no rounding, this conversion
1848 is exact.
1849 @end deftypefun
1850
1851-@deftypefun {char *} mpq_get_str (char *@var{str}, int @var{base}, mpq_t @var{op})
1852+@deftypefun {char *} mpq_get_str (char *@var{str}, int @var{base}, const mpq_t @var{op})
1853 Convert @var{op} to a string of digits in base @var{base}.  The base may vary
1854 from 2 to 36.  The string will be of the form @samp{num/den}, or if the
1855 denominator is 1 then just @samp{num}.
1856@@ -4322,42 +4326,42 @@
1857 @cindex Rational arithmetic functions
1858 @cindex Arithmetic functions
1859
1860-@deftypefun void mpq_add (mpq_t @var{sum}, mpq_t @var{addend1}, mpq_t @var{addend2})
1861+@deftypefun void mpq_add (mpq_t @var{sum}, const mpq_t @var{addend1}, const mpq_t @var{addend2})
1862 Set @var{sum} to @var{addend1} + @var{addend2}.
1863 @end deftypefun
1864
1865-@deftypefun void mpq_sub (mpq_t @var{difference}, mpq_t @var{minuend}, mpq_t @var{subtrahend})
1866+@deftypefun void mpq_sub (mpq_t @var{difference}, const mpq_t @var{minuend}, const mpq_t @var{subtrahend})
1867 Set @var{difference} to @var{minuend} @minus{} @var{subtrahend}.
1868 @end deftypefun
1869
1870-@deftypefun void mpq_mul (mpq_t @var{product}, mpq_t @var{multiplier}, mpq_t @var{multiplicand})
1871+@deftypefun void mpq_mul (mpq_t @var{product}, const mpq_t @var{multiplier}, const mpq_t @var{multiplicand})
1872 Set @var{product} to @math{@var{multiplier} @GMPtimes{} @var{multiplicand}}.
1873 @end deftypefun
1874
1875-@deftypefun void mpq_mul_2exp (mpq_t @var{rop}, mpq_t @var{op1}, mp_bitcnt_t @var{op2})
1876+@deftypefun void mpq_mul_2exp (mpq_t @var{rop}, const mpq_t @var{op1}, mp_bitcnt_t @var{op2})
1877 Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
1878 @var{op2}}.
1879 @end deftypefun
1880
1881-@deftypefun void mpq_div (mpq_t @var{quotient}, mpq_t @var{dividend}, mpq_t @var{divisor})
1882+@deftypefun void mpq_div (mpq_t @var{quotient}, const mpq_t @var{dividend}, const mpq_t @var{divisor})
1883 @cindex Division functions
1884 Set @var{quotient} to @var{dividend}/@var{divisor}.
1885 @end deftypefun
1886
1887-@deftypefun void mpq_div_2exp (mpq_t @var{rop}, mpq_t @var{op1}, mp_bitcnt_t @var{op2})
1888+@deftypefun void mpq_div_2exp (mpq_t @var{rop}, const mpq_t @var{op1}, mp_bitcnt_t @var{op2})
1889 Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised to
1890 @var{op2}}.
1891 @end deftypefun
1892
1893-@deftypefun void mpq_neg (mpq_t @var{negated_operand}, mpq_t @var{operand})
1894+@deftypefun void mpq_neg (mpq_t @var{negated_operand}, const mpq_t @var{operand})
1895 Set @var{negated_operand} to @minus{}@var{operand}.
1896 @end deftypefun
1897
1898-@deftypefun void mpq_abs (mpq_t @var{rop}, mpq_t @var{op})
1899+@deftypefun void mpq_abs (mpq_t @var{rop}, const mpq_t @var{op})
1900 Set @var{rop} to the absolute value of @var{op}.
1901 @end deftypefun
1902
1903-@deftypefun void mpq_inv (mpq_t @var{inverted_number}, mpq_t @var{number})
1904+@deftypefun void mpq_inv (mpq_t @var{inverted_number}, const mpq_t @var{number})
1905 Set @var{inverted_number} to 1/@var{number}.  If the new denominator is
1906 zero, this routine will divide by zero.
1907 @end deftypefun
1908@@ -4368,7 +4372,7 @@
1909 @cindex Rational comparison functions
1910 @cindex Comparison functions
1911
1912-@deftypefun int mpq_cmp (mpq_t @var{op1}, mpq_t @var{op2})
1913+@deftypefun int mpq_cmp (const mpq_t @var{op1}, const mpq_t @var{op2})
1914 Compare @var{op1} and @var{op2}.  Return a positive value if @math{@var{op1} >
1915 @var{op2}}, zero if @math{@var{op1} = @var{op2}}, and a negative value if
1916 @math{@var{op1} < @var{op2}}.
1917@@ -4377,8 +4381,8 @@
1918 @code{mpq_cmp}.
1919 @end deftypefun
1920
1921-@deftypefn Macro int mpq_cmp_ui (mpq_t @var{op1}, unsigned long int @var{num2}, unsigned long int @var{den2})
1922-@deftypefnx Macro int mpq_cmp_si (mpq_t @var{op1}, long int @var{num2}, unsigned long int @var{den2})
1923+@deftypefn Macro int mpq_cmp_ui (const mpq_t @var{op1}, unsigned long int @var{num2}, unsigned long int @var{den2})
1924+@deftypefnx Macro int mpq_cmp_si (const mpq_t @var{op1}, long int @var{num2}, unsigned long int @var{den2})
1925 Compare @var{op1} and @var{num2}/@var{den2}.  Return a positive value if
1926 @math{@var{op1} > @var{num2}/@var{den2}}, zero if @math{@var{op1} =
1927 @var{num2}/@var{den2}}, and a negative value if @math{@var{op1} <
1928@@ -4390,7 +4394,7 @@
1929 multiple times.
1930 @end deftypefn
1931
1932-@deftypefn Macro int mpq_sgn (mpq_t @var{op})
1933+@deftypefn Macro int mpq_sgn (const mpq_t @var{op})
1934 @cindex Sign tests
1935 @cindex Rational sign tests
1936 Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
1937@@ -4400,7 +4404,7 @@
1938 argument multiple times.
1939 @end deftypefn
1940
1941-@deftypefun int mpq_equal (mpq_t @var{op1}, mpq_t @var{op2})
1942+@deftypefun int mpq_equal (const mpq_t @var{op1}, const mpq_t @var{op2})
1943 Return non-zero if @var{op1} and @var{op2} are equal, zero if they are
1944 non-equal.  Although @code{mpq_cmp} can be used for the same purpose, this
1945 function is much faster.
1946@@ -4421,16 +4425,16 @@
1947 (@pxref{Rational Number Functions}) then @code{mpq_canonicalize} must be
1948 called before any other @code{mpq} functions are applied to that @code{mpq_t}.
1949
1950-@deftypefn Macro mpz_t mpq_numref (mpq_t @var{op})
1951-@deftypefnx Macro mpz_t mpq_denref (mpq_t @var{op})
1952+@deftypefn Macro mpz_t mpq_numref (const mpq_t @var{op})
1953+@deftypefnx Macro mpz_t mpq_denref (const mpq_t @var{op})
1954 Return a reference to the numerator and denominator of @var{op}, respectively.
1955 The @code{mpz} functions can be used on the result of these macros.
1956 @end deftypefn
1957
1958-@deftypefun void mpq_get_num (mpz_t @var{numerator}, mpq_t @var{rational})
1959-@deftypefunx void mpq_get_den (mpz_t @var{denominator}, mpq_t @var{rational})
1960-@deftypefunx void mpq_set_num (mpq_t @var{rational}, mpz_t @var{numerator})
1961-@deftypefunx void mpq_set_den (mpq_t @var{rational}, mpz_t @var{denominator})
1962+@deftypefun void mpq_get_num (mpz_t @var{numerator}, const mpq_t @var{rational})
1963+@deftypefunx void mpq_get_den (mpz_t @var{denominator}, const mpq_t @var{rational})
1964+@deftypefunx void mpq_set_num (mpq_t @var{rational}, const mpz_t @var{numerator})
1965+@deftypefunx void mpq_set_den (mpq_t @var{rational}, const mpz_t @var{denominator})
1966 Get or set the numerator or denominator of a rational.  These functions are
1967 equivalent to calling @code{mpz_set} with an appropriate @code{mpq_numref} or
1968 @code{mpq_denref}.  Direct use of @code{mpq_numref} or @code{mpq_denref} is
1969@@ -4458,7 +4462,7 @@
1970
1971 See also @ref{Formatted Output} and @ref{Formatted Input}.
1972
1973-@deftypefun size_t mpq_out_str (FILE *@var{stream}, int @var{base}, mpq_t @var{op})
1974+@deftypefun size_t mpq_out_str (FILE *@var{stream}, int @var{base}, const mpq_t @var{op})
1975 Output @var{op} on stdio stream @var{stream}, as a string of digits in base
1976 @var{base}.  The base may vary from 2 to 36.  Output is in the form
1977 @samp{num/den} or if the denominator is 1 then just @samp{num}.
1978@@ -4621,7 +4625,7 @@
1979 iterative algorithms like Newton-Raphson, making the computation precision
1980 closely match the actual accurate part of the numbers.
1981
1982-@deftypefun {mp_bitcnt_t} mpf_get_prec (mpf_t @var{op})
1983+@deftypefun {mp_bitcnt_t} mpf_get_prec (const mpf_t @var{op})
1984 Return the current precision of @var{op}, in bits.
1985 @end deftypefun
1986
1987@@ -4670,16 +4674,16 @@
1988 These functions assign new values to already initialized floats
1989 (@pxref{Initializing Floats}).
1990
1991-@deftypefun void mpf_set (mpf_t @var{rop}, mpf_t @var{op})
1992+@deftypefun void mpf_set (mpf_t @var{rop}, const mpf_t @var{op})
1993 @deftypefunx void mpf_set_ui (mpf_t @var{rop}, unsigned long int @var{op})
1994 @deftypefunx void mpf_set_si (mpf_t @var{rop}, signed long int @var{op})
1995 @deftypefunx void mpf_set_d (mpf_t @var{rop}, double @var{op})
1996-@deftypefunx void mpf_set_z (mpf_t @var{rop}, mpz_t @var{op})
1997-@deftypefunx void mpf_set_q (mpf_t @var{rop}, mpq_t @var{op})
1998+@deftypefunx void mpf_set_z (mpf_t @var{rop}, const mpz_t @var{op})
1999+@deftypefunx void mpf_set_q (mpf_t @var{rop}, const mpq_t @var{op})
2000 Set the value of @var{rop} from @var{op}.
2001 @end deftypefun
2002
2003-@deftypefun int mpf_set_str (mpf_t @var{rop}, char *@var{str}, int @var{base})
2004+@deftypefun int mpf_set_str (mpf_t @var{rop}, const char *@var{str}, int @var{base})
2005 Set the value of @var{rop} from the string in @var{str}.  The string is of the
2006 form @samp{M@@N} or, if the base is 10 or less, alternatively @samp{MeN}.
2007 @samp{M} is the mantissa and @samp{N} is the exponent.  The mantissa is always
2008@@ -4734,7 +4738,7 @@
2009 float functions.  Don't use an initialize-and-set function on a variable
2010 already initialized!
2011
2012-@deftypefun void mpf_init_set (mpf_t @var{rop}, mpf_t @var{op})
2013+@deftypefun void mpf_init_set (mpf_t @var{rop}, const mpf_t @var{op})
2014 @deftypefunx void mpf_init_set_ui (mpf_t @var{rop}, unsigned long int @var{op})
2015 @deftypefunx void mpf_init_set_si (mpf_t @var{rop}, signed long int @var{op})
2016 @deftypefunx void mpf_init_set_d (mpf_t @var{rop}, double @var{op})
2017@@ -4744,7 +4748,7 @@
2018 set by @code{mpf_set_default_prec}.
2019 @end deftypefun
2020
2021-@deftypefun int mpf_init_set_str (mpf_t @var{rop}, char *@var{str}, int @var{base})
2022+@deftypefun int mpf_init_set_str (mpf_t @var{rop}, const char *@var{str}, int @var{base})
2023 Initialize @var{rop} and set its value from the string in @var{str}.  See
2024 @code{mpf_set_str} above for details on the assignment operation.
2025
2026@@ -4762,7 +4766,7 @@
2027 @cindex Float conversion functions
2028 @cindex Conversion functions
2029
2030-@deftypefun double mpf_get_d (mpf_t @var{op})
2031+@deftypefun double mpf_get_d (const mpf_t @var{op})
2032 Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
2033 towards zero).
2034
2035@@ -4772,7 +4776,7 @@
2036 underflow and denorm traps may or may not occur.
2037 @end deftypefun
2038
2039-@deftypefun double mpf_get_d_2exp (signed long int *@var{exp}, mpf_t @var{op})
2040+@deftypefun double mpf_get_d_2exp (signed long int *@var{exp}, const mpf_t @var{op})
2041 Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
2042 towards zero), and with an exponent returned separately.
2043
2044@@ -4786,8 +4790,8 @@
2045 Functions,,, libc, The GNU C Library Reference Manual}).
2046 @end deftypefun
2047
2048-@deftypefun long mpf_get_si (mpf_t @var{op})
2049-@deftypefunx {unsigned long} mpf_get_ui (mpf_t @var{op})
2050+@deftypefun long mpf_get_si (const mpf_t @var{op})
2051+@deftypefunx {unsigned long} mpf_get_ui (const mpf_t @var{op})
2052 Convert @var{op} to a @code{long} or @code{unsigned long}, truncating any
2053 fraction part.  If @var{op} is too big for the return type, the result is
2054 undefined.
2055@@ -4796,7 +4800,7 @@
2056 (@pxref{Miscellaneous Float Functions}).
2057 @end deftypefun
2058
2059-@deftypefun {char *} mpf_get_str (char *@var{str}, mp_exp_t *@var{expptr}, int @var{base}, size_t @var{n_digits}, mpf_t @var{op})
2060+@deftypefun {char *} mpf_get_str (char *@var{str}, mp_exp_t *@var{expptr}, int @var{base}, size_t @var{n_digits}, const mpf_t @var{op})
2061 Convert @var{op} to a string of digits in base @var{base}.  The base argument
2062 may vary from 2 to 62 or from @minus{}2 to @minus{}36.  Up to @var{n_digits}
2063 digits will be generated.  Trailing zeros are not returned.  No more digits
2064@@ -4838,19 +4842,19 @@
2065 @cindex Float arithmetic functions
2066 @cindex Arithmetic functions
2067
2068-@deftypefun void mpf_add (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
2069-@deftypefunx void mpf_add_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
2070+@deftypefun void mpf_add (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
2071+@deftypefunx void mpf_add_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
2072 Set @var{rop} to @math{@var{op1} + @var{op2}}.
2073 @end deftypefun
2074
2075-@deftypefun void mpf_sub (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
2076-@deftypefunx void mpf_ui_sub (mpf_t @var{rop}, unsigned long int @var{op1}, mpf_t @var{op2})
2077-@deftypefunx void mpf_sub_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
2078+@deftypefun void mpf_sub (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
2079+@deftypefunx void mpf_ui_sub (mpf_t @var{rop}, unsigned long int @var{op1}, const mpf_t @var{op2})
2080+@deftypefunx void mpf_sub_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
2081 Set @var{rop} to @var{op1} @minus{} @var{op2}.
2082 @end deftypefun
2083
2084-@deftypefun void mpf_mul (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
2085-@deftypefunx void mpf_mul_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
2086+@deftypefun void mpf_mul (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
2087+@deftypefunx void mpf_mul_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
2088 Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}}.
2089 @end deftypefun
2090
2091@@ -4859,39 +4863,39 @@
2092 lets the user handle arithmetic exceptions in these functions in the same
2093 manner as other arithmetic exceptions.
2094
2095-@deftypefun void mpf_div (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
2096-@deftypefunx void mpf_ui_div (mpf_t @var{rop}, unsigned long int @var{op1}, mpf_t @var{op2})
2097-@deftypefunx void mpf_div_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
2098+@deftypefun void mpf_div (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
2099+@deftypefunx void mpf_ui_div (mpf_t @var{rop}, unsigned long int @var{op1}, const mpf_t @var{op2})
2100+@deftypefunx void mpf_div_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
2101 @cindex Division functions
2102 Set @var{rop} to @var{op1}/@var{op2}.
2103 @end deftypefun
2104
2105-@deftypefun void mpf_sqrt (mpf_t @var{rop}, mpf_t @var{op})
2106+@deftypefun void mpf_sqrt (mpf_t @var{rop}, const mpf_t @var{op})
2107 @deftypefunx void mpf_sqrt_ui (mpf_t @var{rop}, unsigned long int @var{op})
2108 @cindex Root extraction functions
2109 Set @var{rop} to @m{\sqrt{@var{op}}, the square root of @var{op}}.
2110 @end deftypefun
2111
2112-@deftypefun void mpf_pow_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
2113+@deftypefun void mpf_pow_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
2114 @cindex Exponentiation functions
2115 @cindex Powering functions
2116 Set @var{rop} to @m{@var{op1}^{op2}, @var{op1} raised to the power @var{op2}}.
2117 @end deftypefun
2118
2119-@deftypefun void mpf_neg (mpf_t @var{rop}, mpf_t @var{op})
2120+@deftypefun void mpf_neg (mpf_t @var{rop}, const mpf_t @var{op})
2121 Set @var{rop} to @minus{}@var{op}.
2122 @end deftypefun
2123
2124-@deftypefun void mpf_abs (mpf_t @var{rop}, mpf_t @var{op})
2125+@deftypefun void mpf_abs (mpf_t @var{rop}, const mpf_t @var{op})
2126 Set @var{rop} to the absolute value of @var{op}.
2127 @end deftypefun
2128
2129-@deftypefun void mpf_mul_2exp (mpf_t @var{rop}, mpf_t @var{op1}, mp_bitcnt_t @var{op2})
2130+@deftypefun void mpf_mul_2exp (mpf_t @var{rop}, const mpf_t @var{op1}, mp_bitcnt_t @var{op2})
2131 Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
2132 @var{op2}}.
2133 @end deftypefun
2134
2135-@deftypefun void mpf_div_2exp (mpf_t @var{rop}, mpf_t @var{op1}, mp_bitcnt_t @var{op2})
2136+@deftypefun void mpf_div_2exp (mpf_t @var{rop}, const mpf_t @var{op1}, mp_bitcnt_t @var{op2})
2137 Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised to
2138 @var{op2}}.
2139 @end deftypefun
2140@@ -4902,10 +4906,10 @@
2141 @cindex Float comparison functions
2142 @cindex Comparison functions
2143
2144-@deftypefun int mpf_cmp (mpf_t @var{op1}, mpf_t @var{op2})
2145-@deftypefunx int mpf_cmp_d (mpf_t @var{op1}, double @var{op2})
2146-@deftypefunx int mpf_cmp_ui (mpf_t @var{op1}, unsigned long int @var{op2})
2147-@deftypefunx int mpf_cmp_si (mpf_t @var{op1}, signed long int @var{op2})
2148+@deftypefun int mpf_cmp (const mpf_t @var{op1}, const mpf_t @var{op2})
2149+@deftypefunx int mpf_cmp_d (const mpf_t @var{op1}, double @var{op2})
2150+@deftypefunx int mpf_cmp_ui (const mpf_t @var{op1}, unsigned long int @var{op2})
2151+@deftypefunx int mpf_cmp_si (const mpf_t @var{op1}, signed long int @var{op2})
2152 Compare @var{op1} and @var{op2}.  Return a positive value if @math{@var{op1} >
2153 @var{op2}}, zero if @math{@var{op1} = @var{op2}}, and a negative value if
2154 @math{@var{op1} < @var{op2}}.
2155@@ -4914,7 +4918,7 @@
2156 a NaN.
2157 @end deftypefun
2158
2159-@deftypefun int mpf_eq (mpf_t @var{op1}, mpf_t @var{op2}, mp_bitcnt_t op3)
2160+@deftypefun int mpf_eq (const mpf_t @var{op1}, const mpf_t @var{op2}, mp_bitcnt_t op3)
2161 Return non-zero if the first @var{op3} bits of @var{op1} and @var{op2} are
2162 equal, zero otherwise.  I.e., test if @var{op1} and @var{op2} are approximately
2163 equal.
2164@@ -4927,12 +4931,12 @@
2165 really just one ulp off, and should be considered equal.
2166 @end deftypefun
2167
2168-@deftypefun void mpf_reldiff (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
2169+@deftypefun void mpf_reldiff (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
2170 Compute the relative difference between @var{op1} and @var{op2} and store the
2171 result in @var{rop}.  This is @math{@GMPabs{@var{op1}-@var{op2}}/@var{op1}}.
2172 @end deftypefun
2173
2174-@deftypefn Macro int mpf_sgn (mpf_t @var{op})
2175+@deftypefn Macro int mpf_sgn (const mpf_t @var{op})
2176 @cindex Sign tests
2177 @cindex Float sign tests
2178 Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
2179@@ -4961,7 +4965,7 @@
2180
2181 See also @ref{Formatted Output} and @ref{Formatted Input}.
2182
2183-@deftypefun size_t mpf_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n_digits}, mpf_t @var{op})
2184+@deftypefun size_t mpf_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n_digits}, const mpf_t @var{op})
2185 Print @var{op} to @var{stream}, as a string of digits.  Return the number of
2186 bytes written, or if an error occurred, return 0.
2187
2188@@ -5001,7 +5005,7 @@
2189 Return the number of bytes read, or if an error occurred, return 0.
2190 @end deftypefun
2191
2192-@c @deftypefun void mpf_out_raw (FILE *@var{stream}, mpf_t @var{float})
2193+@c @deftypefun void mpf_out_raw (FILE *@var{stream}, const mpf_t @var{float})
2194 @c Output @var{float} on stdio stream @var{stream}, in raw binary
2195 @c format.  The float is written in a portable format, with 4 bytes of
2196 @c size information, and that many bytes of limbs.  Both the size and the
2197@@ -5020,9 +5024,9 @@
2198 @cindex Miscellaneous float functions
2199 @cindex Float miscellaneous functions
2200
2201-@deftypefun void mpf_ceil (mpf_t @var{rop}, mpf_t @var{op})
2202-@deftypefunx void mpf_floor (mpf_t @var{rop}, mpf_t @var{op})
2203-@deftypefunx void mpf_trunc (mpf_t @var{rop}, mpf_t @var{op})
2204+@deftypefun void mpf_ceil (mpf_t @var{rop}, const mpf_t @var{op})
2205+@deftypefunx void mpf_floor (mpf_t @var{rop}, const mpf_t @var{op})
2206+@deftypefunx void mpf_trunc (mpf_t @var{rop}, const mpf_t @var{op})
2207 @cindex Rounding functions
2208 @cindex Float rounding functions
2209 Set @var{rop} to @var{op} rounded to an integer.  @code{mpf_ceil} rounds to the
2210@@ -5030,16 +5034,16 @@
2211 to the integer towards zero.
2212 @end deftypefun
2213
2214-@deftypefun int mpf_integer_p (mpf_t @var{op})
2215+@deftypefun int mpf_integer_p (const mpf_t @var{op})
2216 Return non-zero if @var{op} is an integer.
2217 @end deftypefun
2218
2219-@deftypefun int mpf_fits_ulong_p (mpf_t @var{op})
2220-@deftypefunx int mpf_fits_slong_p (mpf_t @var{op})
2221-@deftypefunx int mpf_fits_uint_p (mpf_t @var{op})
2222-@deftypefunx int mpf_fits_sint_p (mpf_t @var{op})
2223-@deftypefunx int mpf_fits_ushort_p (mpf_t @var{op})
2224-@deftypefunx int mpf_fits_sshort_p (mpf_t @var{op})
2225+@deftypefun int mpf_fits_ulong_p (const mpf_t @var{op})
2226+@deftypefunx int mpf_fits_slong_p (const mpf_t @var{op})
2227+@deftypefunx int mpf_fits_uint_p (const mpf_t @var{op})
2228+@deftypefunx int mpf_fits_sint_p (const mpf_t @var{op})
2229+@deftypefunx int mpf_fits_ushort_p (const mpf_t @var{op})
2230+@deftypefunx int mpf_fits_sshort_p (const mpf_t @var{op})
2231 Return non-zero if @var{op} would fit in the respective C data type, when
2232 truncated to an integer.
2233 @end deftypefun
2234@@ -5065,7 +5069,7 @@
2235 random numbers are generated when @var{max_size} is negative.
2236 @end deftypefun
2237
2238-@c @deftypefun size_t mpf_size (mpf_t @var{op})
2239+@c @deftypefun size_t mpf_size (const mpf_t @var{op})
2240 @c Return the size of @var{op} measured in number of limbs.  If @var{op} is
2241 @c zero, the returned value will be zero.  (@xref{Nomenclature}, for an
2242 @c explanation of the concept @dfn{limb}.)
2243@@ -5690,7 +5694,7 @@
2244 fast and has good randomness properties.
2245 @end deftypefun
2246
2247-@deftypefun void gmp_randinit_lc_2exp (gmp_randstate_t @var{state}, mpz_t @var{a}, @w{unsigned long @var{c}}, @w{mp_bitcnt_t @var{m2exp}})
2248+@deftypefun void gmp_randinit_lc_2exp (gmp_randstate_t @var{state}, const mpz_t @var{a}, @w{unsigned long @var{c}}, @w{mp_bitcnt_t @var{m2exp}})
2249 @cindex Linear congruential random numbers
2250 Initialize @var{state} with a linear congruential algorithm @m{X = (@var{a}X +
2251 @var{c}) @bmod 2^{m2exp}, X = (@var{a}*X + @var{c}) mod 2^@var{m2exp}}.
2252@@ -5758,7 +5762,7 @@
2253 @cindex Random number seeding
2254 @cindex Seeding random numbers
2255
2256-@deftypefun void gmp_randseed (gmp_randstate_t @var{state}, mpz_t @var{seed})
2257+@deftypefun void gmp_randseed (gmp_randstate_t @var{state}, const mpz_t @var{seed})
2258 @deftypefunx void gmp_randseed_ui (gmp_randstate_t @var{state}, @w{unsigned long int @var{seed}})
2259 Set an initial seed value into @var{state}.
2260
2261diff -rNU3 dist.orig/doc/stamp-vti dist.nbsd/doc/stamp-vti
2262--- dist.orig/doc/stamp-vti	Mon May 20 15:00:17 2013
2263+++ dist.nbsd/doc/stamp-vti	Wed Feb 19 16:34:37 2014
2264@@ -1,4 +1,4 @@
2265-@set UPDATED 20 May 2013
2266-@set UPDATED-MONTH May 2013
2267-@set EDITION 5.1.2
2268-@set VERSION 5.1.2
2269+@set UPDATED 30 September 2013
2270+@set UPDATED-MONTH September 2013
2271+@set EDITION 5.1.3
2272+@set VERSION 5.1.3
2273diff -rNU3 dist.orig/doc/version.texi dist.nbsd/doc/version.texi
2274--- dist.orig/doc/version.texi	Mon May 20 15:00:17 2013
2275+++ dist.nbsd/doc/version.texi	Wed Feb 19 16:34:37 2014
2276@@ -1,4 +1,4 @@
2277-@set UPDATED 20 May 2013
2278-@set UPDATED-MONTH May 2013
2279-@set EDITION 5.1.2
2280-@set VERSION 5.1.2
2281+@set UPDATED 30 September 2013
2282+@set UPDATED-MONTH September 2013
2283+@set EDITION 5.1.3
2284+@set VERSION 5.1.3
2285diff -rNU3 dist.orig/gmp-h.in dist.nbsd/gmp-h.in
2286--- dist.orig/gmp-h.in	Mon May 20 14:59:56 2013
2287+++ dist.nbsd/gmp-h.in	Wed Feb 19 16:34:37 2014
2288@@ -359,11 +359,9 @@
2289     GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
2290     inline semantics, unless -fgnu89-inline is used.  */
2291 #ifdef __GNUC__
2292-#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2) \
2293-  || (defined __GNUC_GNU_INLINE__ && defined __cplusplus)
2294+#if (defined __GNUC_STDC_INLINE__) || \
2295+    (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__GNUC__ > 4)
2296 #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
2297-#else
2298-#define __GMP_EXTERN_INLINE      extern __inline__
2299 #endif
2300 #define __GMP_INLINE_PROTOTYPES  1
2301 #endif
2302@@ -1610,6 +1608,10 @@
2303 #define mpn_zero __MPN(zero)
2304 __GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
2305
2306+#define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv)
2307+__GMP_DECLSPEC mp_limb_t mpn_udiv_w_sdiv (mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t);
2308+
2309+
2310 /**************** mpz inlines ****************/
2311
2312 /* The following are provided as inlines where possible, but always exist as
2313@@ -2222,7 +2224,7 @@
2314 /* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
2315 #define __GNU_MP_VERSION            5
2316 #define __GNU_MP_VERSION_MINOR      1
2317-#define __GNU_MP_VERSION_PATCHLEVEL 2
2318+#define __GNU_MP_VERSION_PATCHLEVEL 3
2319 #define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
2320
2321 #define __GMP_H__
2322diff -rNU3 dist.orig/gmp-impl.h dist.nbsd/gmp-impl.h
2323--- dist.orig/gmp-impl.h	Mon May 20 14:59:56 2013
2324+++ dist.nbsd/gmp-impl.h	Wed Feb 19 16:34:37 2014
2325@@ -196,7 +196,9 @@
2326 #     if defined (_AIX) || defined (_IBMR2)
2327  #pragma alloca
2328 #     else
2329-       char *alloca ();
2330+#      if !defined (__NetBSD__)
2331+        char *alloca ();
2332+#      endif
2333 #     endif
2334 #    endif
2335 #   endif
2336diff -rNU3 dist.orig/mpn/Makefile.in dist.nbsd/mpn/Makefile.in
2337--- dist.orig/mpn/Makefile.in	Mon May 20 15:00:03 2013
2338+++ dist.nbsd/mpn/Makefile.in	Wed Feb 19 16:34:37 2014
2339@@ -631,7 +631,7 @@
2340 	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
2341 	$(RM_TMP) tmp-$*.s
2342 .S.lo:
2343-	$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
2344+	$(LIBTOOL) --mode=compile --tag=CC $(SHELL) $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
2345
2346 # .asm assembler, preprocessed with m4.
2347 #
2348@@ -659,7 +659,7 @@
2349 	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
2350 	$(RM_TMP) tmp-$*.s
2351 .asm.lo:
2352-	$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
2353+	$(LIBTOOL) --mode=compile --tag=CC $(SHELL) $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
2354
2355 # Tell versions [3.59,3.63) of GNU make to not export all variables.
2356 # Otherwise a system limit (for SysV at least) may be exceeded.
2357diff -rNU3 dist.orig/mpn/arm/aorscnd_n.asm dist.nbsd/mpn/arm/aorscnd_n.asm
2358--- dist.orig/mpn/arm/aorscnd_n.asm	Mon May 20 14:59:56 2013
2359+++ dist.nbsd/mpn/arm/aorscnd_n.asm	Wed Feb 19 16:34:37 2014
2360@@ -117,5 +117,8 @@
2361
2362 L(end):	RETVAL
2363 	pop	{r4-r11}
2364-	bx	r14
2365+ifdef(`ARM_THUMB_MODE',
2366+`	bx	r14
2367+',`	mov	pc, r14
2368+')
2369 EPILOGUE()
2370diff -rNU3 dist.orig/mpn/arm/aorslsh1_n.asm dist.nbsd/mpn/arm/aorslsh1_n.asm
2371--- dist.orig/mpn/arm/aorslsh1_n.asm	Mon May 20 14:59:56 2013
2372+++ dist.nbsd/mpn/arm/aorslsh1_n.asm	Wed Feb 19 16:34:37 2014
2373@@ -151,5 +151,8 @@
2374 	REVCY(r12)
2375 L(rt0):	RETVAL(	r14)
2376 	pop	{r4-r10r11, r14}
2377-	bx	r14
2378+ifdef(`ARM_THUMB_MODE',
2379+`	bx	r14
2380+',`	mov	pc, r14
2381+')
2382 EPILOGUE()
2383diff -rNU3 dist.orig/mpn/arm/bdiv_dbm1c.asm dist.nbsd/mpn/arm/bdiv_dbm1c.asm
2384--- dist.orig/mpn/arm/bdiv_dbm1c.asm	Mon May 20 14:59:56 2013
2385+++ dist.nbsd/mpn/arm/bdiv_dbm1c.asm	Wed Feb 19 16:34:37 2014
2386@@ -97,5 +97,8 @@
2387 	str	r5, [qp]
2388 	sbc	r0, r5, r12
2389 	pop	{r4, r5, r6, r7, r8}
2390-	bx	lr
2391+ifdef(`ARM_THUMB_MODE',
2392+`	bx	lr
2393+',`	mov	pc, lr
2394+')
2395 EPILOGUE()
2396diff -rNU3 dist.orig/mpn/arm/com.asm dist.nbsd/mpn/arm/com.asm
2397--- dist.orig/mpn/arm/com.asm	Mon May 20 14:59:56 2013
2398+++ dist.nbsd/mpn/arm/com.asm	Wed Feb 19 16:34:37 2014
2399@@ -59,5 +59,9 @@
2400 	bne	L(top)
2401
2402 	ldmfd	sp!, { r7, r8, r9 }		C restore regs from stack
2403-L(rtn):	bx	lr
2404+L(rtn):
2405+ifdef(`ARM_THUMB_MODE',
2406+`	bx	lr
2407+',`	mov	pc, lr
2408+')
2409 EPILOGUE()
2410diff -rNU3 dist.orig/mpn/arm/copyd.asm dist.nbsd/mpn/arm/copyd.asm
2411--- dist.orig/mpn/arm/copyd.asm	Mon May 20 14:59:56 2013
2412+++ dist.nbsd/mpn/arm/copyd.asm	Wed Feb 19 16:34:37 2014
2413@@ -57,5 +57,9 @@
2414 	bne	L(top)
2415
2416 	ldmfd	sp!, { r7, r8, r9 }		C restore regs from stack
2417-L(rtn):	bx	lr
2418+L(rtn):
2419+ifdef(`ARM_THUMB_MODE',
2420+`	bx	lr
2421+',`	mov	pc, lr
2422+')
2423 EPILOGUE()
2424diff -rNU3 dist.orig/mpn/arm/copyi.asm dist.nbsd/mpn/arm/copyi.asm
2425--- dist.orig/mpn/arm/copyi.asm	Mon May 20 14:59:56 2013
2426+++ dist.nbsd/mpn/arm/copyi.asm	Wed Feb 19 16:34:37 2014
2427@@ -52,5 +52,9 @@
2428 	bne	L(top)
2429
2430 	ldmfd	sp!, { r7, r8, r9 }		C restore regs from stack
2431-L(rtn):	bx	lr
2432+L(rtn):
2433+ifdef(`ARM_THUMB_MODE',
2434+`	bx	lr
2435+',`	mov	pc, lr
2436+')
2437 EPILOGUE()
2438diff -rNU3 dist.orig/mpn/arm/invert_limb.asm dist.nbsd/mpn/arm/invert_limb.asm
2439--- dist.orig/mpn/arm/invert_limb.asm	Mon May 20 14:59:56 2013
2440+++ dist.nbsd/mpn/arm/invert_limb.asm	Wed Feb 19 16:34:37 2014
2441@@ -41,7 +41,10 @@
2442 	adds	r1, r12, r0
2443 	adc	r3, r3, r0
2444 	rsb	r0, r3, r2
2445-	bx	lr
2446+ifdef(`ARM_THUMB_MODE',
2447+`	bx	lr
2448+',`	mov	pc, lr
2449+')
2450 EPILOGUE()
2451
2452 	.section .rodata
2453diff -rNU3 dist.orig/mpn/arm/logops_n.asm dist.nbsd/mpn/arm/logops_n.asm
2454--- dist.orig/mpn/arm/logops_n.asm	Mon May 20 14:59:56 2013
2455+++ dist.nbsd/mpn/arm/logops_n.asm	Wed Feb 19 16:34:37 2014
2456@@ -123,5 +123,8 @@
2457 	pop	{ r4, r5, r6, r7 }	C popping r8-r10 here strangely fails
2458
2459 L(rtn):	pop	{ r8, r9, r10 }
2460-	bx	r14
2461+ifdef(`ARM_THUMB_MODE',
2462+`	bx	r14
2463+',`	mov	pc, r14
2464+')
2465 EPILOGUE()
2466diff -rNU3 dist.orig/mpn/arm/lshift.asm dist.nbsd/mpn/arm/lshift.asm
2467--- dist.orig/mpn/arm/lshift.asm	Mon May 20 14:59:56 2013
2468+++ dist.nbsd/mpn/arm/lshift.asm	Wed Feb 19 16:34:37 2014
2469@@ -72,5 +72,8 @@
2470 L(1):	str	r7, [rp, #-4]
2471 	lsr	r0, r4, tnc
2472 	pop	{r4, r6, r7, r8}
2473-	bx	r14
2474+ifdef(`ARM_THUMB_MODE',
2475+`	bx	r14
2476+',`	mov	pc, r14
2477+')
2478 EPILOGUE()
2479diff -rNU3 dist.orig/mpn/arm/lshiftc.asm dist.nbsd/mpn/arm/lshiftc.asm
2480--- dist.orig/mpn/arm/lshiftc.asm	Mon May 20 14:59:56 2013
2481+++ dist.nbsd/mpn/arm/lshiftc.asm	Wed Feb 19 16:34:37 2014
2482@@ -79,5 +79,8 @@
2483 	str	r7, [rp, #-4]
2484 	lsr	r0, r4, tnc
2485 	pop	{r4, r6, r7, r8}
2486-	bx	r14
2487+ifdef(`ARM_THUMB_MODE',
2488+`	bx	r14
2489+',`	mov	pc, r14
2490+')
2491 EPILOGUE()
2492diff -rNU3 dist.orig/mpn/arm/mod_34lsub1.asm dist.nbsd/mpn/arm/mod_34lsub1.asm
2493--- dist.orig/mpn/arm/mod_34lsub1.asm	Mon May 20 14:59:56 2013
2494+++ dist.nbsd/mpn/arm/mod_34lsub1.asm	Wed Feb 19 16:34:37 2014
2495@@ -94,7 +94,10 @@
2496 	add	r0, r0, r12, lsr #8
2497
2498 	pop	{ r4, r5, r6, r7 }
2499-	bx	lr
2500+ifdef(`ARM_THUMB_MODE',
2501+`	bx	lr
2502+',`	mov	pc, lr
2503+')
2504
2505 L(le2):	cmn	n, #1
2506 	bne	L(1)
2507@@ -105,5 +108,8 @@
2508 	bic	r0, r2, #0xff000000
2509 	add	r0, r0, r2, lsr #24
2510 	pop	{ r4, r5, r6, r7 }
2511-	bx	lr
2512+ifdef(`ARM_THUMB_MODE',
2513+`	bx	lr
2514+',`	mov	pc, lr
2515+')
2516 EPILOGUE()
2517diff -rNU3 dist.orig/mpn/arm/mode1o.asm dist.nbsd/mpn/arm/mode1o.asm
2518--- dist.orig/mpn/arm/mode1o.asm	Mon May 20 14:59:56 2013
2519+++ dist.nbsd/mpn/arm/mode1o.asm	Wed Feb 19 16:34:37 2014
2520@@ -68,5 +68,8 @@
2521 	addcc	r0, r0, #1
2522
2523 	ldmfd	sp!, {r4, r5}
2524-	bx	r14
2525+ifdef(`ARM_THUMB_MODE',
2526+`	bx	r14
2527+',`	mov	pc, r14
2528+')
2529 EPILOGUE()
2530diff -rNU3 dist.orig/mpn/arm/rsh1aors_n.asm dist.nbsd/mpn/arm/rsh1aors_n.asm
2531--- dist.orig/mpn/arm/rsh1aors_n.asm	Mon May 20 14:59:56 2013
2532+++ dist.nbsd/mpn/arm/rsh1aors_n.asm	Wed Feb 19 16:34:37 2014
2533@@ -108,5 +108,8 @@
2534 	str	r4, [rp, #0]
2535 	mov	r0, r11
2536 	pop	{r4-r11}
2537-	bx	r14
2538+ifdef(`ARM_THUMB_MODE',
2539+`	bx	r14
2540+',`	mov	pc, r14
2541+')
2542 EPILOGUE()
2543diff -rNU3 dist.orig/mpn/arm/rshift.asm dist.nbsd/mpn/arm/rshift.asm
2544--- dist.orig/mpn/arm/rshift.asm	Mon May 20 14:59:56 2013
2545+++ dist.nbsd/mpn/arm/rshift.asm	Wed Feb 19 16:34:37 2014
2546@@ -70,5 +70,8 @@
2547 L(1):	str	r7, [rp], #4
2548 	lsl	r0, r4, tnc
2549 	pop	{r4, r6, r7, r8}
2550-	bx	r14
2551+ifdef(`ARM_THUMB_MODE',
2552+`	bx	r14
2553+',`	mov	pc, r14
2554+')
2555 EPILOGUE()
2556diff -rNU3 dist.orig/mpn/arm/udiv.asm dist.nbsd/mpn/arm/udiv.asm
2557--- dist.orig/mpn/arm/udiv.asm	Mon May 20 14:59:56 2013
2558+++ dist.nbsd/mpn/arm/udiv.asm	Wed Feb 19 16:34:37 2014
2559@@ -50,7 +50,10 @@
2560
2561 	str	n1, [rem_ptr]		C store remainder
2562 	adc	r0, n0, n0		C quotient: add last carry from divstep
2563-	bx	lr
2564+ifdef(`ARM_THUMB_MODE',
2565+`	bx	lr
2566+',`	mov	pc, lr
2567+')
2568
2569 L(_large_divisor):
2570 	stmfd	sp!, { r8, lr }
2571Binary files dist.orig/mpn/generic/div_qr_2.c and dist.nbsd/mpn/generic/div_qr_2.c differ
2572diff -rNU3 dist.orig/mpn/generic/divrem_2.c dist.nbsd/mpn/generic/divrem_2.c
2573--- dist.orig/mpn/generic/divrem_2.c	Mon May 20 14:59:57 2013
2574+++ dist.nbsd/mpn/generic/divrem_2.c	Wed Feb 19 16:34:37 2014
2575@@ -98,7 +98,7 @@
2576       for (i = qxn - 1; i >= 0; i--)
2577 	{
2578 	  mp_limb_t q;
2579-	  udiv_qr_3by2 (q, r1, r0, r1, r0, 0, d1, d0, di.inv32);
2580+	  udiv_qr_3by2 (q, r1, r0, r1, r0, CNST_LIMB(0), d1, d0, di.inv32);
2581 	  qp[i] = q;
2582 	}
2583     }
2584diff -rNU3 dist.orig/mpn/generic/get_d.c dist.nbsd/mpn/generic/get_d.c
2585--- dist.orig/mpn/generic/get_d.c	Mon May 20 14:59:57 2013
2586+++ dist.nbsd/mpn/generic/get_d.c	Wed Feb 19 16:34:37 2014
2587@@ -135,7 +135,7 @@
2588      overflow.  After this exp can of course be reduced to anywhere within
2589      the {up,size} region without underflow.  */
2590   if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size)
2591-		> (unsigned long) (LONG_MAX - exp)))
2592+		> ((unsigned long) LONG_MAX - exp)))
2593     {
2594 #if _GMP_IEEE_FLOATS
2595       goto ieee_infinity;
2596@@ -209,7 +209,7 @@
2597 	      x <<= GMP_NAIL_BITS;
2598 	      mhi |= x >> nbits >> 11;
2599
2600-	      mlo = x << GMP_LIMB_BITS - nbits - 11;
2601+	      mlo = x << (GMP_LIMB_BITS - nbits - 11);
2602 	      nbits = nbits + 11 - GMP_NAIL_BITS;
2603 	    }
2604 	  else
2605Binary files dist.orig/mpn/generic/mod_1_1.c and dist.nbsd/mpn/generic/mod_1_1.c differ
2606diff -rNU3 dist.orig/mpn/generic/mod_1_2.c dist.nbsd/mpn/generic/mod_1_2.c
2607--- dist.orig/mpn/generic/mod_1_2.c	Mon May 20 14:59:57 2013
2608+++ dist.nbsd/mpn/generic/mod_1_2.c	Wed Feb 19 16:34:37 2014
2609@@ -51,10 +51,10 @@
2610   ASSERT (B1modb <= b);		/* NB: not fully reduced mod b */
2611   cps[2] = B1modb >> cnt;
2612
2613-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
2614+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
2615   cps[3] = B2modb >> cnt;
2616
2617-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
2618+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
2619   cps[4] = B3modb >> cnt;
2620
2621 #if WANT_ASSERT
2622diff -rNU3 dist.orig/mpn/generic/mod_1_3.c dist.nbsd/mpn/generic/mod_1_3.c
2623--- dist.orig/mpn/generic/mod_1_3.c	Mon May 20 14:59:57 2013
2624+++ dist.nbsd/mpn/generic/mod_1_3.c	Wed Feb 19 16:34:37 2014
2625@@ -51,13 +51,13 @@
2626   ASSERT (B1modb <= b);		/* NB: not fully reduced mod b */
2627   cps[2] = B1modb >> cnt;
2628
2629-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
2630+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
2631   cps[3] = B2modb >> cnt;
2632
2633-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
2634+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
2635   cps[4] = B3modb >> cnt;
2636
2637-  udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
2638+  udiv_rnnd_preinv (B4modb, B3modb, CNST_LIMB(0), b, bi);
2639   cps[5] = B4modb >> cnt;
2640
2641 #if WANT_ASSERT
2642diff -rNU3 dist.orig/mpn/generic/mod_1_4.c dist.nbsd/mpn/generic/mod_1_4.c
2643--- dist.orig/mpn/generic/mod_1_4.c	Mon May 20 14:59:57 2013
2644+++ dist.nbsd/mpn/generic/mod_1_4.c	Wed Feb 19 16:34:37 2014
2645@@ -51,16 +51,16 @@
2646   ASSERT (B1modb <= b);		/* NB: not fully reduced mod b */
2647   cps[2] = B1modb >> cnt;
2648
2649-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
2650+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
2651   cps[3] = B2modb >> cnt;
2652
2653-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
2654+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
2655   cps[4] = B3modb >> cnt;
2656
2657-  udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
2658+  udiv_rnnd_preinv (B4modb, B3modb, CNST_LIMB(0), b, bi);
2659   cps[5] = B4modb >> cnt;
2660
2661-  udiv_rnnd_preinv (B5modb, B4modb, 0, b, bi);
2662+  udiv_rnnd_preinv (B5modb, B4modb, CNST_LIMB(0), b, bi);
2663   cps[6] = B5modb >> cnt;
2664
2665 #if WANT_ASSERT
2666diff -rNU3 dist.orig/mpn/generic/sb_div_sec.c dist.nbsd/mpn/generic/sb_div_sec.c
2667--- dist.orig/mpn/generic/sb_div_sec.c	Mon May 20 14:59:57 2013
2668+++ dist.nbsd/mpn/generic/sb_div_sec.c	Wed Feb 19 16:34:37 2014
2669@@ -81,18 +81,9 @@
2670       np2 = np;
2671     }
2672
2673-  if (dn == 1)
2674-    {
2675-      d0 = dp2[dn - 1];
2676-      invert_limb (inv32, d0);
2677-    }
2678-  else
2679-    {
2680-      d1 = dp2[dn - 1];
2681-      d0 = dp2[dn - 2];
2682-      invert_pi1 (dinv, d1, d0);
2683-      inv32 = dinv.inv32;
2684-    }
2685+  d0 = dp2[dn - 1];
2686+  d0 += (~d0 != 0);
2687+  invert_limb (inv32, d0);
2688
2689   /* We add nn + dn to tp here, not nn + 1 + dn, as expected.  This is since nn
2690      here will have been incremented.  */
2691diff -rNU3 dist.orig/mpn/generic/sbpi1_div_sec.c dist.nbsd/mpn/generic/sbpi1_div_sec.c
2692--- dist.orig/mpn/generic/sbpi1_div_sec.c	Mon May 20 14:59:57 2013
2693+++ dist.nbsd/mpn/generic/sbpi1_div_sec.c	Wed Feb 19 16:34:37 2014
2694@@ -8,7 +8,7 @@
2695    SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
2696    GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
2697
2698-Copyright 2011, 2012 Free Software Foundation, Inc.
2699+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
2700
2701 This file is part of the GNU MP Library.
2702
2703@@ -29,6 +29,28 @@
2704 #include "gmp-impl.h"
2705 #include "longlong.h"
2706
2707+/* This side-channel silent division algorithm reduces the partial remainder by
2708+   GMP_NUMB_BITS/2 bits at a time, compared to GMP_NUMB_BITS for the main
2709+   division algorithm.  We do not insists on reducing by exactly
2710+   GMP_NUMB_BITS/2, but may leave a partial remainder that is D*B^i to 3D*B^i
2711+   too large (B is the limb base, D is the divisor, and i is the induction
2712+   variable); the subsequent step will handle the extra partial remainder bits.
2713+
2714+   With that partial remainder reduction, each step generates a quotient "half
2715+   limb".  The outer loop generates two quotient half limbs, an upper (q1h) and
2716+   a lower (q0h) which are stored sparsely in separate limb arrays.  These
2717+   arrays are added at the end; using separate arrays avoids data-dependent
2718+   carry propagation which could else pose a side-channel leakage problem.
2719+
2720+   The quotient half limbs may be between -3 to 0 from the accurate value
2721+   ("accurate" being the one which corresponds to a reduction to a principal
2722+   partial remainder).  Too small quotient half limbs correspond to too large
2723+   remainders, which we reduce later, as described above.
2724+
2725+   In order to keep quotients from getting too big, corresponding to a negative
2726+   partial remainder, we use an inverse which is slightly smaller than usually.
2727+*/
2728+
2729 #if OPERATION_sbpi1_div_qr_sec
2730 /* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
2731 #define FNAME mpn_sbpi1_div_qr_sec
2732@@ -49,7 +71,7 @@
2733        mp_limb_t dinv,
2734        mp_ptr tp)
2735 {
2736-  mp_limb_t nh, cy, q1h, q0h, dummy, h;
2737+  mp_limb_t nh, cy, q1h, q0h, dummy, cnd;
2738   mp_size_t i;
2739   mp_ptr hp;
2740 #if OPERATION_sbpi1_div_qr_sec
2741@@ -74,75 +96,64 @@
2742
2743   /* Create a divisor copy shifted half a limb.  */
2744   hp = tp;					/* (dn + 1) limbs */
2745-  cy = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
2746-  hp[dn] = dp[dn - 1] >> GMP_NUMB_BITS / 2;
2747+  hp[dn] = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
2748
2749 #if OPERATION_sbpi1_div_qr_sec
2750   qlp = tp + (dn + 1);				/* (nn - dn) limbs */
2751   qhp = tp + (nn + 1);				/* (nn - dn) limbs */
2752 #endif
2753
2754-  np += nn;
2755-
2756-  /* Main loop.  Develop one full limb per iteration, but do it in two steps in
2757-     order to avoid conditionals.  Quotient bits will be either correct or
2758-     underestimates.  When a quotient is underestimated, the next quotient will
2759-     compensate, since quotients are to be added at consecutive weight distance
2760-     GMP_NUMB_BITS/2.  We make two quotient arrays, each with GMP_NUMB_BITS/2+2
2761-     bits per entry.  The arrays are added late after the loop.  Separate
2762-     arrays avoid data-dependent carry propagation.  */
2763+  np += nn - dn;
2764   nh = 0;
2765+
2766   for (i = nn - dn - 1; i >= 0; i--)
2767     {
2768       np--;
2769
2770-      nh = (nh << GMP_NUMB_BITS/2) + (np[0] >> GMP_NUMB_BITS/2);
2771+      nh = (nh << GMP_NUMB_BITS/2) + (np[dn] >> GMP_NUMB_BITS/2);
2772       umul_ppmm (q1h, dummy, nh, dinv);
2773       q1h += nh;
2774 #if OPERATION_sbpi1_div_qr_sec
2775       qhp[i] = q1h;
2776 #endif
2777-      cy = mpn_submul_1 (np - dn, hp, dn + 1, q1h);
2778+      mpn_submul_1 (np, hp, dn + 1, q1h);
2779
2780-      nh = np[0];
2781+      nh = np[dn];
2782       umul_ppmm (q0h, dummy, nh, dinv);
2783       q0h += nh;
2784 #if OPERATION_sbpi1_div_qr_sec
2785       qlp[i] = q0h;
2786 #endif
2787-      cy = mpn_submul_1 (np - dn, dp, dn, q0h);
2788-
2789-      nh -= cy;
2790+      nh -= mpn_submul_1 (np, dp, dn, q0h);
2791     }
2792
2793-  np[0] = nh;
2794-
2795-  np -= dn;
2796-
2797   /* 1st adjustment depends on extra high remainder limb.  */
2798-  h = np[dn];
2799+  cnd = nh != 0;				/* FIXME: cmp-to-int */
2800 #if OPERATION_sbpi1_div_qr_sec
2801-  qlp[0] += h;
2802+  qlp[0] += cnd;
2803 #endif
2804-  h -= mpn_subcnd_n (np, np, dp, dn, h);
2805+  nh -= mpn_subcnd_n (np, np, dp, dn, cnd);
2806
2807-  /* 2nd adjustment depends on remainder/divisor comparision as well as whether
2808+  /* 2nd adjustment depends on remainder/divisor comparison as well as whether
2809      extra remainder limb was nullified by previous subtract.  */
2810   cy = mpn_sub_n (np, np, dp, dn);
2811-  cy = cy == h;				/* FIXME: might leak on some archs */
2812+  cy = cy - nh;
2813 #if OPERATION_sbpi1_div_qr_sec
2814-  qlp[0] += cy;
2815+  qlp[0] += 1 - cy;
2816 #endif
2817-  mpn_addcnd_n (np, np, dp, dn, 1 - cy);
2818+  mpn_addcnd_n (np, np, dp, dn, cy);
2819
2820-  /* Combine quotient halves into final quotient.  */
2821+  /* 3rd adjustment depends on remainder/divisor comparison.  */
2822+  cy = mpn_sub_n (np, np, dp, dn);
2823 #if OPERATION_sbpi1_div_qr_sec
2824-  qh = 0;
2825-  if (nn - dn != 0)
2826-    {
2827-      qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
2828-      qh += mpn_add_n (qp, qhp, qlp, nn - dn);
2829-    }
2830+  qlp[0] += 1 - cy;
2831+#endif
2832+  mpn_addcnd_n (np, np, dp, dn, cy);
2833+
2834+#if OPERATION_sbpi1_div_qr_sec
2835+  /* Combine quotient halves into final quotient.  */
2836+  qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
2837+  qh += mpn_add_n (qp, qhp, qlp, nn - dn);
2838
2839   return qh;
2840 #else
2841Binary files dist.orig/mpn/generic/toom_interpolate_7pts.c and dist.nbsd/mpn/generic/toom_interpolate_7pts.c differ
2842diff -rNU3 dist.orig/mpn/ia64/divrem_2.asm dist.nbsd/mpn/ia64/divrem_2.asm
2843--- dist.orig/mpn/ia64/divrem_2.asm	Mon May 20 14:59:57 2013
2844+++ dist.nbsd/mpn/ia64/divrem_2.asm	Wed Feb 19 16:34:37 2014
2845@@ -1,6 +1,6 @@
2846 dnl  IA-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
2847
2848-dnl  Copyright 2010 Free Software Foundation, Inc.
2849+dnl  Copyright 2010, 2013 Free Software Foundation, Inc.
2850
2851 dnl  This file is part of the GNU MP Library.
2852
2853@@ -98,17 +98,17 @@
2854 	br.call.sptk.many b0 = mpn_invert_limb
2855 	;;
2856 	setf.sig f11 = r8		// di (non-final)
2857-	setf.sig f18 = r39		// d1
2858-	setf.sig f17 = r36		// d0
2859+	setf.sig f34 = r39		// d1
2860+	setf.sig f33 = r36		// d0
2861 	mov	 r1 = r43
2862 	;;
2863 	mov	 r17 = 1
2864 	setf.sig f9 = r38		// n2
2865-	xma.l	 f6 = f11, f18, f0	// t0 = LO(di * d1)
2866+	xma.l	 f6 = f11, f34, f0	// t0 = LO(di * d1)
2867 	;;
2868 	setf.sig f10 = r37		// n1
2869 	setf.sig f15 = r17		// 1
2870-	xma.hu	 f8 = f11, f17, f0	// s0 = HI(di * d0)
2871+	xma.hu	 f8 = f11, f33, f0	// s0 = HI(di * d0)
2872 	;;
2873 	getf.sig r17 = f6
2874 	getf.sig r16 = f8
2875@@ -178,7 +178,7 @@
2876   (p9)	br.cond.dptk .L52
2877 .L46:
2878 ')
2879-	setf.sig f16 = r8		// di
2880+	setf.sig f32 = r8		// di
2881 	shladd	 r32 = r35, 3, r32
2882 	;;
2883
2884@@ -189,8 +189,8 @@
2885 	;;
2886  (p8)	mov	 r37 = r0
2887  (p9)	ld8	 r37 = [r34], -8
2888-	xma.hu	 f8 = f9, f16, f10	//				0,29
2889-	xma.l	 f12 = f9, f16, f10	//				0
2890+	xma.hu	 f8 = f9, f32, f10	//				0,29
2891+	xma.l	 f12 = f9, f32, f10	//				0
2892 	;;
2893 	getf.sig r20 = f12		// q0				4
2894 	xma.l	 f13 = f15, f8, f9	// q += n2			4
2895@@ -198,8 +198,8 @@
2896 	;;
2897 	getf.sig r18 = f13		//				8
2898 	xma.l	 f7 = f14, f13, f10	//				8
2899-	xma.l	 f6 = f17, f13, f17	// t0 = LO(d0*q+d0)		8
2900-	xma.hu	 f9 = f17, f13, f17	// t1 = HI(d0*q+d0)		9
2901+	xma.l	 f6 = f33, f13, f33	// t0 = LO(d0*q+d0)		8
2902+	xma.hu	 f9 = f33, f13, f33	// t1 = HI(d0*q+d0)		9
2903 	;;
2904 	getf.sig r38 = f7		// n1				12
2905 	getf.sig r16 = f6		//				13
2906diff -rNU3 dist.orig/mpn/powerpc32/elf.m4 dist.nbsd/mpn/powerpc32/elf.m4
2907--- dist.orig/mpn/powerpc32/elf.m4	Mon May 20 14:59:57 2013
2908+++ dist.nbsd/mpn/powerpc32/elf.m4	Wed Feb 19 16:34:37 2014
2909@@ -41,9 +41,11 @@
2910 m4_assert_numargs(2)
2911 `ifdef(`PIC',`
2912 	mflr	r0
2913-	bl	_GLOBAL_OFFSET_TABLE_@local-4
2914-	mflr	$1
2915+	bl	20,31,1f
2916+1:	mflr	$1
2917 	mtlr	r0
2918+	addis	$1,$1,_GLOBAL_OFFSET_TABLE_-1b@ha
2919+	addi	$1,$1,_GLOBAL_OFFSET_TABLE_-1b@l
2920 	lwz	$1, $2@got($1)
2921 ',`
2922 	lis	$1, $2@ha
2923diff -rNU3 dist.orig/mpn/powerpc64/p6/lshift.asm dist.nbsd/mpn/powerpc64/p6/lshift.asm
2924--- dist.orig/mpn/powerpc64/p6/lshift.asm	Mon May 20 14:59:57 2013
2925+++ dist.nbsd/mpn/powerpc64/p6/lshift.asm	Wed Feb 19 16:34:37 2014
2926@@ -1,6 +1,6 @@
2927 dnl  PowerPC-64 mpn_lshift -- rp[] = up[] << cnt
2928
2929-dnl  Copyright 2003, 2005, 2010 Free Software Foundation, Inc.
2930+dnl  Copyright 2003, 2005, 2010, 2013 Free Software Foundation, Inc.
2931
2932 dnl  This file is part of the GNU MP Library.
2933
2934@@ -27,8 +27,7 @@
2935
2936 C TODO
2937 C  * Micro-optimise header code
2938-C  * Write analogous lshiftc.asm
2939-C  * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6.  The code is 4248
2940+C  * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6.  The code is 4236
2941 C    bytes, 4-way code would become about 50% larger.
2942
2943 C INPUT PARAMETERS
2944@@ -43,45 +42,49 @@
2945
2946 ASM_START()
2947 PROLOGUE(mpn_lshift)
2948+
2949+ifdef(`HAVE_ABI_mode32',`
2950+	rldicl	n, n, 0,32		C FIXME: avoid this zero extend
2951+')
2952 	mflr	r12
2953-	bcl	20, 31, L(r)		C get pc using a local "call"
2954-L(r):	mflr	r11
2955-	sldi	r0, n, 3
2956+	sldi	r8, n, 3
2957 	sldi	r10, cnt, 6		C multiply cnt by size of a SHIFT block
2958-	addi	r11, r11, L(e1)-Lr-64	C address of L(e1) label in SHIFT(1)
2959-	add	up, up, r0		C make up point at end of up[]
2960+	LEAL(	r11, L(e1))		C address of L(e1) label in SHIFT(1)
2961+	add	up, up, r8		C make up point at end of up[]
2962 	add	r11, r11, r10		C address of L(oN) for N = cnt
2963-	add	rp, rp_param, r0	C make rp point at end of rp[]
2964+	srdi	r10, n, 1
2965+	add	rp, rp_param, r8	C make rp point at end of rp[]
2966 	subfic	tnc, cnt, 64
2967-	rlwinm.  r8, n, 0,31,31		C extract bit 0
2968+	rlwinm.	r8, n, 0,31,31		C extract bit 0
2969+	mtctr	r10
2970 	beq	L(evn)
2971
2972 L(odd):	ld	r9, -8(up)
2973 	cmpdi	cr0, n, 1		C n = 1?
2974 	beq	L(1)
2975 	ld	r8, -16(up)
2976-	addi	r11, r11, L(o1)-L(e1)
2977+	addi	r11, r11, -84		C L(o1) - L(e1) - 64
2978 	mtlr	r11
2979-	srdi	r11, n, 1
2980 	srd	r3, r9, tnc		C retval
2981 	addi	up, up, 8
2982 	addi	rp, rp, -8
2983-	mtctr	r11
2984 	blr				C branch to L(oN)
2985
2986 L(evn):	ld	r8, -8(up)
2987 	ld	r9, -16(up)
2988+	addi	r11, r11, -64
2989 	mtlr	r11
2990-	addi	n, n, 1
2991-	srdi	r10, n, 1
2992 	srd	r3, r8, tnc		C retval
2993-	mtctr	r10
2994 	blr				C branch to L(eN)
2995
2996 L(1):	srd	r3, r9, tnc		C retval
2997 	sld	r8, r9, cnt
2998 	std	r8, -8(rp)
2999 	mtlr	r12
3000+ifdef(`HAVE_ABI_mode32',
3001+`	mr	r4, r3
3002+	srdi	r3, r3, 32
3003+')
3004 	blr
3005
3006
3007@@ -109,5 +112,10 @@
3008
3009 L(com):	std	r10, -16(rp)
3010 	mtlr	r12
3011+ifdef(`HAVE_ABI_mode32',
3012+`	mr	r4, r3
3013+	srdi	r3, r3, 32
3014+')
3015 	blr
3016 EPILOGUE()
3017+ASM_END()
3018diff -rNU3 dist.orig/mpn/powerpc64/p6/lshiftc.asm dist.nbsd/mpn/powerpc64/p6/lshiftc.asm
3019--- dist.orig/mpn/powerpc64/p6/lshiftc.asm	Mon May 20 14:59:57 2013
3020+++ dist.nbsd/mpn/powerpc64/p6/lshiftc.asm	Wed Feb 19 16:34:37 2014
3021@@ -1,6 +1,6 @@
3022 dnl  PowerPC-64 mpn_lshiftc -- rp[] = ~up[] << cnt
3023
3024-dnl  Copyright 2003, 2005, 2010 Free Software Foundation, Inc.
3025+dnl  Copyright 2003, 2005, 2010, 2013 Free Software Foundation, Inc.
3026
3027 dnl  This file is part of the GNU MP Library.
3028
3029@@ -27,7 +27,7 @@
3030
3031 C TODO
3032 C  * Micro-optimise header code
3033-C  * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6.  The code is 4248
3034+C  * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6.  The code is 4236
3035 C    bytes, 4-way code would become about 50% larger.
3036
3037 C INPUT PARAMETERS
3038@@ -42,39 +42,39 @@
3039
3040 ASM_START()
3041 PROLOGUE(mpn_lshiftc)
3042+
3043+ifdef(`HAVE_ABI_mode32',`
3044+	rldicl	n, n, 0,32		C FIXME: avoid this zero extend
3045+')
3046 	mflr	r12
3047-	bcl	20, 31, L(r)		C get pc using a local "call"
3048-L(r):	mflr	r11
3049-	sldi	r0, n, 3
3050+	sldi	r8, n, 3
3051 	sldi	r10, cnt, 6		C multiply cnt by size of a SHIFT block
3052-	addi	r11, r11, L(e1)-Lr-64	C address of L(e1) label in SHIFT(1)
3053-	add	up, up, r0		C make up point at end of up[]
3054+	LEAL(	r11, L(e1))		C address of L(e1) label in SHIFT(1)
3055+	add	up, up, r8		C make up point at end of up[]
3056 	add	r11, r11, r10		C address of L(oN) for N = cnt
3057-	add	rp, rp_param, r0	C make rp point at end of rp[]
3058+	srdi	r10, n, 1
3059+	add	rp, rp_param, r8	C make rp point at end of rp[]
3060 	subfic	tnc, cnt, 64
3061-	rlwinm.  r8, n, 0,31,31		C extract bit 0
3062+	rlwinm.	r8, n, 0,31,31		C extract bit 0
3063+	mtctr	r10
3064 	beq	L(evn)
3065
3066 L(odd):	ld	r9, -8(up)
3067 	cmpdi	cr0, n, 1		C n = 1?
3068 	beq	L(1)
3069 	ld	r8, -16(up)
3070-	addi	r11, r11, L(o1)-L(e1)
3071+	addi	r11, r11, -88		C L(o1) - L(e1) - 64
3072 	mtlr	r11
3073-	srdi	r11, n, 1
3074 	srd	r3, r9, tnc		C retval
3075 	addi	up, up, 8
3076 	addi	rp, rp, -8
3077-	mtctr	r11
3078 	blr				C branch to L(oN)
3079
3080 L(evn):	ld	r8, -8(up)
3081 	ld	r9, -16(up)
3082+	addi	r11, r11, -64
3083 	mtlr	r11
3084-	addi	n, n, 1
3085-	srdi	r10, n, 1
3086 	srd	r3, r8, tnc		C retval
3087-	mtctr	r10
3088 	blr				C branch to L(eN)
3089
3090 L(1):	srd	r3, r9, tnc		C retval
3091@@ -82,6 +82,10 @@
3092 	nor	r8, r8, r8
3093 	std	r8, -8(rp)
3094 	mtlr	r12
3095+ifdef(`HAVE_ABI_mode32',
3096+`	mr	r4, r3
3097+	srdi	r3, r3, 32
3098+')
3099 	blr
3100
3101
3102@@ -112,5 +116,10 @@
3103 	std	r11, -8(rp)
3104 	std	r10, -16(rp)
3105 	mtlr	r12
3106+ifdef(`HAVE_ABI_mode32',
3107+`	mr	r4, r3
3108+	srdi	r3, r3, 32
3109+')
3110 	blr
3111 EPILOGUE()
3112+ASM_END()
3113diff -rNU3 dist.orig/mpn/powerpc64/p6/rshift.asm dist.nbsd/mpn/powerpc64/p6/rshift.asm
3114--- dist.orig/mpn/powerpc64/p6/rshift.asm	Mon May 20 14:59:57 2013
3115+++ dist.nbsd/mpn/powerpc64/p6/rshift.asm	Wed Feb 19 16:34:37 2014
3116@@ -1,6 +1,6 @@
3117 dnl  PowerPC-64 mpn_rshift -- rp[] = up[] << cnt
3118
3119-dnl  Copyright 2003, 2005, 2010 Free Software Foundation, Inc.
3120+dnl  Copyright 2003, 2005, 2010, 2013 Free Software Foundation, Inc.
3121
3122 dnl  This file is part of the GNU MP Library.
3123
3124@@ -42,44 +42,48 @@
3125
3126 ASM_START()
3127 PROLOGUE(mpn_rshift)
3128+
3129+ifdef(`HAVE_ABI_mode32',`
3130+	rldicl	n, n, 0,32		C FIXME: avoid this zero extend
3131+')
3132 	mflr	r12
3133-	bcl	20, 31, L(r)		C get pc using a local "call"
3134-L(r):	mflr	r11
3135-	addi	r11, r11, L(e1)-Lr-64	C address of L(e1) label in SHIFT(1)
3136+	LEAL(	r11, L(e1))		C address of L(e1) label in SHIFT(1)
3137 	sldi	r10, cnt, 6		C multiply cnt by size of a SHIFT block
3138 	add	r11, r11, r10		C address of L(oN) for N = cnt
3139+	srdi	r10, n, 1
3140 	mr	rp, rp_param
3141 	subfic	tnc, cnt, 64
3142-	rlwinm.  r8, n, 0,31,31		C extract bit 0
3143+	rlwinm.	r8, n, 0,31,31		C extract bit 0
3144+	mtctr	r10
3145 	beq	L(evn)
3146
3147 L(odd):	ld	r9, 0(up)
3148 	cmpdi	cr0, n, 1		C n = 1?
3149 	beq	L(1)
3150 	ld	r8, 8(up)
3151-	addi	r11, r11, L(o1)-L(e1)
3152+	addi	r11, r11, -84		C L(o1) - L(e1) - 64
3153 	mtlr	r11
3154-	srdi	r11, n, 1
3155 	sld	r3, r9, tnc		C retval
3156 	addi	up, up, 8
3157 	addi	rp, rp, 8
3158-	mtctr	r11
3159 	blr				C branch to L(oN)
3160
3161 L(evn):	ld	r8, 0(up)
3162 	ld	r9, 8(up)
3163+	addi	r11, r11, -64
3164 	mtlr	r11
3165-	addi	n, n, 1
3166-	srdi	r10, n, 1
3167 	sld	r3, r8, tnc		C retval
3168 	addi	up, up, 16
3169-	mtctr	r10
3170 	blr				C branch to L(eN)
3171
3172 L(1):	sld	r3, r9, tnc		C retval
3173 	srd	r8, r9, cnt
3174 	std	r8, 0(rp)
3175 	mtlr	r12
3176+ifdef(`HAVE_ABI_mode32',
3177+`	mr	r4, r3
3178+	srdi	r3, r3, 32
3179+')
3180 	blr
3181
3182
3183@@ -107,5 +111,10 @@
3184
3185 L(com):	std	r10, 8(rp)
3186 	mtlr	r12
3187+ifdef(`HAVE_ABI_mode32',
3188+`	mr	r4, r3
3189+	srdi	r3, r3, 32
3190+')
3191 	blr
3192 EPILOGUE()
3193+ASM_END()
3194diff -rNU3 dist.orig/mpz/kronzs.c dist.nbsd/mpz/kronzs.c
3195--- dist.orig/mpz/kronzs.c	Mon May 20 14:59:58 2013
3196+++ dist.nbsd/mpz/kronzs.c	Wed Feb 19 16:34:37 2014
3197@@ -50,7 +50,7 @@
3198 #endif
3199
3200   result_bit1 = JACOBI_BSGN_SS_BIT1 (a_size, b);
3201-  b_limb = (unsigned long) ABS (b);
3202+  b_limb = ABS_CAST (unsigned long, b);
3203   a_ptr = PTR(a);
3204
3205   if ((b_limb & 1) == 0)
3206diff -rNU3 dist.orig/tests/mpz/t-mfac_uiui.c dist.nbsd/tests/mpz/t-mfac_uiui.c
3207--- dist.orig/tests/mpz/t-mfac_uiui.c	Mon May 20 14:59:58 2013
3208+++ dist.nbsd/tests/mpz/t-mfac_uiui.c	Wed Feb 19 16:34:37 2014
3209@@ -66,7 +66,7 @@
3210       MPZ_CHECK_FORMAT (res);
3211       if (mpz_cmp (ref[m], res) != 0)
3212         {
3213-          printf ("mpz_mfac_uiui(%lu,&i) wrong\n", n, MULTIFAC_WHEEL);
3214+          printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL);
3215           printf ("  got  "); mpz_out_str (stdout, 10, res); printf("\n");
3216           printf ("  want "); mpz_out_str (stdout, 10, ref[m]); printf("\n");
3217           abort ();
3218@@ -75,7 +75,7 @@
3219       MPZ_CHECK_FORMAT (res);
3220       if (mpz_cmp (ref2[m2], res) != 0)
3221         {
3222-          printf ("mpz_mfac_uiui(%lu,&i) wrong\n", n, MULTIFAC_WHEEL2);
3223+          printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL2);
3224           printf ("  got  "); mpz_out_str (stdout, 10, res); printf("\n");
3225           printf ("  want "); mpz_out_str (stdout, 10, ref2[m2]); printf("\n");
3226           abort ();
3227diff -rNU3 dist.orig/tests/rand/findlc.c dist.nbsd/tests/rand/findlc.c
3228--- dist.orig/tests/rand/findlc.c	Mon May 20 14:59:58 2013
3229+++ dist.nbsd/tests/rand/findlc.c	Wed Feb 19 16:34:37 2014
3230@@ -27,7 +27,7 @@
3231 #define RCSID(msg) \
3232 static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
3233
3234-RCSID("$Id$");
3235+RCSID("$Id: findlc.c,v 1.1.1.2 2013/11/29 07:49:48 mrg Exp $");
3236
3237 int g_debug = 0;
3238
3239