[Gmp-commit] /var/hg/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri Aug 16 23:01:36 UTC 2019


details:   /var/hg/gmp/rev/05e1c7e3fabf
changeset: 17822:05e1c7e3fabf
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sat Aug 17 00:52:42 2019 +0200
description:
Include gmp-impl.h.

details:   /var/hg/gmp/rev/09b43121e3c2
changeset: 17823:09b43121e3c2
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sat Aug 17 00:55:49 2019 +0200
description:
Provide refmpn_gcd_22.

details:   /var/hg/gmp/rev/731706bff51e
changeset: 17824:731706bff51e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sat Aug 17 00:59:04 2019 +0200
description:
Add gcd_22

diffstat:

 mpn/asm-defs.m4     |   1 +
 tests/mpf/t-get_d.c |   2 +-
 tests/refmpn.c      |  40 ++++++++++++++++++++++++++++++++++++++++
 tests/t-constants.c |   2 +-
 tests/tests.h       |   1 +
 5 files changed, 44 insertions(+), 2 deletions(-)

diffs (96 lines):

diff -r 6938e1d9fdf1 -r 731706bff51e mpn/asm-defs.m4
--- a/mpn/asm-defs.m4	Sat Aug 17 00:14:58 2019 +0200
+++ b/mpn/asm-defs.m4	Sat Aug 17 00:59:04 2019 +0200
@@ -1395,6 +1395,7 @@
 define_mpn(gcd)
 define_mpn(gcd_1)
 define_mpn(gcd_11)
+define_mpn(gcd_22)
 define_mpn(gcdext)
 define_mpn(get_str)
 define_mpn(hamdist)
diff -r 6938e1d9fdf1 -r 731706bff51e tests/mpf/t-get_d.c
--- a/tests/mpf/t-get_d.c	Sat Aug 17 00:14:58 2019 +0200
+++ b/tests/mpf/t-get_d.c	Sat Aug 17 00:59:04 2019 +0200
@@ -19,7 +19,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "gmp.h"
+#include "gmp-impl.h"
 #include "tests.h"
 
 #if defined (__vax) || defined (__vax__)
diff -r 6938e1d9fdf1 -r 731706bff51e tests/refmpn.c
--- a/tests/refmpn.c	Sat Aug 17 00:14:58 2019 +0200
+++ b/tests/refmpn.c	Sat Aug 17 00:59:04 2019 +0200
@@ -2001,6 +2001,46 @@
   return y;
 }
 
+mp_double_limb_t
+refmpn_gcd_22 (mp_limb_t x1, mp_limb_t x0, mp_limb_t y1, mp_limb_t y0)
+{
+  ASSERT ((x0 & 1) != 0);
+  ASSERT ((y0 & 1) != 0);
+  mp_double_limb_t g;
+  mp_limb_t cy;
+
+  do
+    {
+      while ((x0 & 1) == 0)
+	{
+	  x0 = (x1 << (GMP_NUMB_BITS - 1)) | (x0 >> 1);
+	  x1 >>= 1;
+	}
+      while ((y0 & 1) == 0)
+	{
+	  y0 = (y1 << (GMP_NUMB_BITS - 1)) | (y0 >> 1);
+	  y1 >>= 1;
+	}
+
+
+      if (x1 < y1 || (x1 == y1 && x0 < y0))
+	{
+	  mp_limb_t t;
+	  t = x1; x1 = y1; y1 = t;
+	  t = x0; x0 = y0; y0 = t;
+	}
+
+      cy = (x0 < y0);
+      x0 -= y0;
+      x1 -= y1 + cy;
+    }
+  while ((x1 | x0) != 0);
+
+  g.d1 = y1;
+  g.d0 = y0;
+  return g;
+}
+
 mp_limb_t
 refmpn_gcd_1 (mp_srcptr xp, mp_size_t xsize, mp_limb_t y)
 {
diff -r 6938e1d9fdf1 -r 731706bff51e tests/t-constants.c
--- a/tests/t-constants.c	Sat Aug 17 00:14:58 2019 +0200
+++ b/tests/t-constants.c	Sat Aug 17 00:59:04 2019 +0200
@@ -19,7 +19,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "gmp.h"
+#include "gmp-impl.h"
 #include "tests.h"
 
 
diff -r 6938e1d9fdf1 -r 731706bff51e tests/tests.h
--- a/tests/tests.h	Sat Aug 17 00:14:58 2019 +0200
+++ b/tests/tests.h	Sat Aug 17 00:59:04 2019 +0200
@@ -232,6 +232,7 @@
 
 mp_limb_t refmpn_gcd_11 (mp_limb_t, mp_limb_t);
 mp_limb_t refmpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t);
+mp_double_limb_t refmpn_gcd_22 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t);
 mp_limb_t refmpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
 
 size_t refmpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);


More information about the gmp-commit mailing list