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