summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-02-18 00:08:42 +0100
committerKevin Ryde <user42@zip.com.au>2004-02-18 00:08:42 +0100
commita4dc37d02ec30a24f5b75fd0a77e65c66d8ae670 (patch)
tree77ca49ca5c2bcd1f93148b0cbe718da3d7998d22 /mpf
parentee7135b092eef818097b30b72dcc28136e593721 (diff)
downloadgmp-a4dc37d02ec30a24f5b75fd0a77e65c66d8ae670.tar.gz
* mpf/iset_si.c, mpf/iset_ui.c, mpf/set_si.c, mpf/set_ui.c [nails]:
Always store second limb, to avoid a conditional.
Diffstat (limited to 'mpf')
-rw-r--r--mpf/iset_si.c13
-rw-r--r--mpf/iset_ui.c13
-rw-r--r--mpf/set_si.c13
-rw-r--r--mpf/set_ui.c12
4 files changed, 23 insertions, 28 deletions
diff --git a/mpf/iset_si.c b/mpf/iset_si.c
index 717c4f3de..da7db76d4 100644
--- a/mpf/iset_si.c
+++ b/mpf/iset_si.c
@@ -1,6 +1,7 @@
/* mpf_init_set_si() -- Initialize a float and assign it from a signed int.
-Copyright 1993, 1994, 1995, 2000, 2001, 2003 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 2000, 2001, 2003, 2004 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -37,12 +38,10 @@ mpf_init_set_si (mpf_ptr r, long int val)
r->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
-#if GMP_NAIL_BITS != 0
- if (vl > GMP_NUMB_MAX)
- {
- r->_mp_d[1] = vl >> GMP_NUMB_BITS;
- size = 2;
- }
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ vl >>= GMP_NUMB_BITS;
+ r->_mp_d[1] = vl;
+ size += (vl != 0);
#endif
r->_mp_exp = size;
diff --git a/mpf/iset_ui.c b/mpf/iset_ui.c
index bf18ce842..96ef7d59b 100644
--- a/mpf/iset_ui.c
+++ b/mpf/iset_ui.c
@@ -1,6 +1,7 @@
/* mpf_init_set_ui() -- Initialize a float and assign it from an unsigned int.
-Copyright 1993, 1994, 1995, 2000, 2001, 2003 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 2000, 2001, 2003, 2004 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -33,12 +34,10 @@ mpf_init_set_ui (mpf_ptr r, unsigned long int val)
r->_mp_d[0] = val & GMP_NUMB_MASK;
size = (val != 0);
-#if GMP_NAIL_BITS != 0
- if (val > GMP_NUMB_MAX)
- {
- r->_mp_d[1] = val >> GMP_NUMB_BITS;
- size = 2;
- }
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ val >>= GMP_NUMB_BITS;
+ r->_mp_d[1] = val;
+ size += (val != 0);
#endif
r->_mp_size = size;
diff --git a/mpf/set_si.c b/mpf/set_si.c
index 43c698494..de7c81e2f 100644
--- a/mpf/set_si.c
+++ b/mpf/set_si.c
@@ -1,6 +1,7 @@
/* mpf_set_si() -- Assign a float from a signed int.
-Copyright 1993, 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 2000, 2001, 2002, 2004 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -33,12 +34,10 @@ mpf_set_si (mpf_ptr dest, long val)
dest->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
-#if GMP_NAIL_BITS != 0
- if (vl > GMP_NUMB_MAX)
- {
- dest->_mp_d[1] = vl >> GMP_NUMB_BITS;
- size = 2;
- }
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ vl >>= GMP_NUMB_BITS;
+ dest->_mp_d[1] = vl;
+ size += (vl != 0);
#endif
dest->_mp_exp = size;
diff --git a/mpf/set_ui.c b/mpf/set_ui.c
index 96dc003ac..438c914a6 100644
--- a/mpf/set_ui.c
+++ b/mpf/set_ui.c
@@ -1,6 +1,6 @@
/* mpf_set_ui() -- Assign a float from an unsigned int.
-Copyright 1993, 1994, 1995, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -30,12 +30,10 @@ mpf_set_ui (mpf_ptr f, unsigned long val)
f->_mp_d[0] = val & GMP_NUMB_MASK;
size = val != 0;
-#if GMP_NAIL_BITS != 0
- if (val > GMP_NUMB_MAX)
- {
- f->_mp_d[1] = val >> GMP_NUMB_BITS;
- size = 2;
- }
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ val >>= GMP_NUMB_BITS;
+ f->_mp_d[1] = val;
+ size += (val != 0);
#endif
f->_mp_exp = f->_mp_size = size;