summaryrefslogtreecommitdiff
path: root/mpz/bin_uiui.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2020-10-29 07:42:04 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2020-10-29 07:42:04 +0100
commitd0397f95bfcdfa2c3952b06295d69c849fc73558 (patch)
treeae0dc3c077bc81d95cf5794dbdf33da1a8cc61c0 /mpz/bin_uiui.c
parent4dc90a38398bcd52993515631e6ffcca9b4f5697 (diff)
downloadgmp-d0397f95bfcdfa2c3952b06295d69c849fc73558.tar.gz
limb_apprsqrt: Slightly faster formula
Diffstat (limited to 'mpz/bin_uiui.c')
-rw-r--r--mpz/bin_uiui.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mpz/bin_uiui.c b/mpz/bin_uiui.c
index c62e0ec2e..542d4858e 100644
--- a/mpz/bin_uiui.c
+++ b/mpz/bin_uiui.c
@@ -2,7 +2,7 @@
Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-Copyright 2010-2012, 2015-2018 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015-2018, 2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -584,7 +584,7 @@ limb_apprsqrt (mp_limb_t x)
ASSERT (x > 2);
count_leading_zeros (s, x);
s = (GMP_LIMB_BITS - s) >> 1;
- return ((CNST_LIMB(1) << s) + (x >> s)) >> 1;
+ return ((CNST_LIMB(1) << (s - 1)) + (x >> 1 >> s));
}
static void