diff options
author | kan <kan@FreeBSD.org> | 2007-05-19 01:19:51 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2007-05-19 01:19:51 +0000 |
commit | 1f9ea4d0a40cca64d60cf4dab152349da7b9dddf (patch) | |
tree | 0cb530c9c38af219e6dda2994c078b6b2b9ad853 /contrib/gcc/sreal.c | |
parent | 4895159b2b4f648051c1f139faa7b6dc50c2bfcb (diff) | |
download | FreeBSD-src-1f9ea4d0a40cca64d60cf4dab152349da7b9dddf.zip FreeBSD-src-1f9ea4d0a40cca64d60cf4dab152349da7b9dddf.tar.gz |
GCC 4.2.0 release.
Diffstat (limited to 'contrib/gcc/sreal.c')
-rw-r--r-- | contrib/gcc/sreal.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/contrib/gcc/sreal.c b/contrib/gcc/sreal.c index 8980659..5982d26 100644 --- a/contrib/gcc/sreal.c +++ b/contrib/gcc/sreal.c @@ -1,5 +1,5 @@ /* Simple data type for positive real numbers for the GNU compiler. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -15,8 +15,8 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ /* This library supports positive real numbers and 0; inf and nan are NOT supported. @@ -94,17 +94,12 @@ copy (sreal *r, sreal *a) static inline void shift_right (sreal *x, int s) { -#ifdef ENABLE_CHECKING - if (s <= 0 || s > SREAL_BITS) - abort (); - if (x->exp + s > SREAL_MAX_EXP) - { - /* Exponent should never be so large because shift_right is used only by - sreal_add and sreal_sub ant thus the number cannot be shifted out from - exponent range. */ - abort (); - } -#endif + gcc_assert (s > 0); + gcc_assert (s <= SREAL_BITS); + /* Exponent should never be so large because shift_right is used only by + sreal_add and sreal_sub ant thus the number cannot be shifted out from + exponent range. */ + gcc_assert (x->exp + s <= SREAL_MAX_EXP); x->exp += s; @@ -401,10 +396,7 @@ sreal_sub (sreal *r, sreal *a, sreal *b) sreal tmp; sreal *bb; - if (sreal_compare (a, b) < 0) - { - abort (); - } + gcc_assert (sreal_compare (a, b) >= 0); dexp = a->exp - b->exp; r->exp = a->exp; @@ -509,11 +501,8 @@ sreal_div (sreal *r, sreal *a, sreal *b) #if SREAL_PART_BITS < 32 unsigned HOST_WIDE_INT tmp, tmp1, tmp2; - if (b->sig_hi < SREAL_MIN_SIG) - { - abort (); - } - else if (a->sig_hi < SREAL_MIN_SIG) + gcc_assert (b->sig_hi >= SREAL_MIN_SIG); + if (a->sig_hi < SREAL_MIN_SIG) { r->sig_hi = 0; r->sig_lo = 0; @@ -546,16 +535,10 @@ sreal_div (sreal *r, sreal *a, sreal *b) normalize (r); } #else - if (b->sig == 0) - { - abort (); - } - else - { - r->sig = (a->sig << SREAL_PART_BITS) / b->sig; - r->exp = a->exp - b->exp - SREAL_PART_BITS; - normalize (r); - } + gcc_assert (b->sig != 0); + r->sig = (a->sig << SREAL_PART_BITS) / b->sig; + r->exp = a->exp - b->exp - SREAL_PART_BITS; + normalize (r); #endif return r; } |