/* Operations with long integers.
- Copyright (C) 2006 Free Software Foundation, Inc.
-
+ Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+
This file is part of GCC.
-
+
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
later version.
-
+
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
/* Clears the bits of CST over the precision PREC. If UNS is false, the bits
outside of the precision are set to the sign bit (i.e., the PREC-th one),
otherwise they are set to zero.
-
+
This corresponds to returning the value represented by PREC lowermost bits
of CST, with the given signedness. */
{
r.low = cst.low & mask.low;
r.high = cst.high & mask.high;
- }
+ }
return r;
}
is unsigned. */
double_int
-tree_to_double_int (tree cst)
+tree_to_double_int (const_tree cst)
{
/* We do not need to call double_int_restrict here to ensure the semantics as
described, as this is the default one for trees. */
{
double_int ret;
- div_and_round_double (code, uns, a.low, a.high, b.low, b.high,
- &ret.low, &ret.high, &mod->low, &mod->high);
+ div_and_round_double ((enum tree_code) code, uns, a.low, a.high,
+ b.low, b.high, &ret.low, &ret.high,
+ &mod->low, &mod->high);
return ret;
}
to be the same as the signedness of TYPE. */
bool
-double_int_fits_to_tree_p (tree type, double_int cst)
+double_int_fits_to_tree_p (const_tree type, double_int cst)
{
double_int ext = double_int_ext (cst,
TYPE_PRECISION (type),
return -1;
if (a.high > b.high)
return 1;
- if ((HOST_WIDE_INT) a.low < (HOST_WIDE_INT) b.low)
+ if (a.low < b.low)
return -1;
- if ((HOST_WIDE_INT) a.low > (HOST_WIDE_INT) b.low)
+ if (a.low > b.low)
return 1;
return 0;
appropriate minimum or maximum TYPE bound. */
double_int
-mpz_get_double_int (tree type, mpz_t val, bool wrap)
+mpz_get_double_int (const_tree type, mpz_t val, bool wrap)
{
unsigned HOST_WIDE_INT *vp;
size_t count, numb;
double_int res;
if (!wrap)
- {
+ {
mpz_t min, max;
mpz_init (min);