summaryrefslogtreecommitdiff
path: root/mpf/iset_si.c
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/iset_si.c
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/iset_si.c')
-rw-r--r--mpf/iset_si.c13
1 files changed, 6 insertions, 7 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;