aboutsummaryrefslogtreecommitdiff
path: root/gcc/sreal.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-12-17 22:11:46 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2014-12-17 21:11:46 +0000
commit6c0c245e30e159720d62954a978ec2eb4d526d88 (patch)
tree78d1b62334419d5a244d634c647dc1fd0ac08abb /gcc/sreal.c
parent12d9ce19034428072b3779eff017c5e129ee4c0e (diff)
downloadgcc-6c0c245e30e159720d62954a978ec2eb4d526d88.zip
gcc-6c0c245e30e159720d62954a978ec2eb4d526d88.tar.gz
gcc-6c0c245e30e159720d62954a978ec2eb4d526d88.tar.bz2
sreal.h (sreal::normalize): Implement inline.
* sreal.h (sreal::normalize): Implement inline. (sreal::normalize_up): New function. (sreal::normalize_down): New function. * sreal.c (sreal::normalize): Remove. From-SVN: r218833
Diffstat (limited to 'gcc/sreal.c')
-rw-r--r--gcc/sreal.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/gcc/sreal.c b/gcc/sreal.c
index 8525379..cf6b738 100644
--- a/gcc/sreal.c
+++ b/gcc/sreal.c
@@ -96,64 +96,6 @@ sreal::shift_right (int s)
m_sig >>= s;
}
-/* Normalize *this. */
-
-void
-sreal::normalize ()
-{
- int64_t s = m_sig < 0 ? -1 : 1;
- unsigned HOST_WIDE_INT sig = absu_hwi (m_sig);
-
- if (sig == 0)
- {
- m_exp = -SREAL_MAX_EXP;
- }
- else if (sig < SREAL_MIN_SIG)
- {
- do
- {
- sig <<= 1;
- m_exp--;
- }
- while (sig < SREAL_MIN_SIG);
-
- /* Check underflow. */
- if (m_exp < -SREAL_MAX_EXP)
- {
- m_exp = -SREAL_MAX_EXP;
- sig = 0;
- }
- }
- else if (sig > SREAL_MAX_SIG)
- {
- int last_bit;
- do
- {
- last_bit = sig & 1;
- sig >>= 1;
- m_exp++;
- }
- while (sig > SREAL_MAX_SIG);
-
- /* Round the number. */
- sig += last_bit;
- if (sig > SREAL_MAX_SIG)
- {
- sig >>= 1;
- m_exp++;
- }
-
- /* Check overflow. */
- if (m_exp > SREAL_MAX_EXP)
- {
- m_exp = SREAL_MAX_EXP;
- sig = SREAL_MAX_SIG;
- }
- }
-
- m_sig = s * sig;
-}
-
/* Return integer value of *this. */
int64_t