On 08/28/2013 12:45 PM, Mike Stump wrote:
On Aug 28, 2013, at 5:48 AM, Richard Biener <rguent...@suse.de> wrote:
Only if the precision is > HOST_BITS_PER_WIDE_INT. If the precision
is HOST_BITS_PER_WIDE_INT then both are { -1U }.
That wasn't my understanding on how things work.
You are thinking about prec==0 numbers. These are useful and important for
ease of use of the wide-int package. They allow one to do:
wide_int w = …;
w = w + 6;
w = w - 3;
w = w + (unsigned HOST_WIDE_INT)~0;
and extend the constant out to the precision of the other side. This is a very
narrow feature and not a general property of a wide_int. In general,
signedness of a wide_int is an external feature of wide_int. We only permit
prec==0 numbers for ease of use, and ease of use needs to track the sign, in
the general case. Now, one is free to have a precision that allows the sign to
be stored, this is available to the user, if they want. They merely are not
forced to do this. For example, RTL largely doesn't want or need a sign.
Right, that's what the constructors, from_* and to_* routines do.
I wonder where the from_tree and to_tree ones are?
tree t;
wide_int w = t;
wide_int_to_tree needs an additional type, so, the spelling is not as short out
of necessity.
i made wide_int_to_tree a function that lives in tree.[ch], not a member
function of wide-int. This seemed to be consistent with the way other
things were done. if you want it to be a member function, that is
certainly doable.
Are they
from_double_int / wide_int_to_tree (what's wide_int_to_infinite_tree?)
I think wide_int_to_infinite_tree is leftover junk. I removed it:
diff --git a/gcc/wide-int.h b/gcc/wide-int.h
index 86be20a..83c2170 100644
--- a/gcc/wide-int.h
+++ b/gcc/wide-int.h
@@ -4203,8 +4203,6 @@ wide_int_ro::to_shwi2 (HOST_WIDE_INT *s ATTRIBUTE_UNUSED,
/* tree related routines. */
extern tree wide_int_to_tree (tree type, const wide_int_ro &cst);
-extern tree wide_int_to_infinite_tree (tree type, const wide_int_ro &cst,
- unsigned int prec);
extern tree force_fit_type_wide (tree, const wide_int_ro &, int, bool);
/* real related routines. */