This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: On INTEGER_CST


On 13 Mar 2007 07:58:41 -0700, Ian Lance Taylor <iant@google.com> wrote:
"Paulo J. Matos" <pocm@soton.ac.uk> writes:

> INTEGER_CST seems to have TREE_INT_CST_LOW and TREE_INT_CST_HIGH
> fields (tree.def). Each has 32 bits.

No, each has type HOST_WIDE_INT.  On a 64-bit host they will be 64
bits.

> 1 - Should I use ints for these fields?

I don't understand the question.


Which C type is HOST_WIDE_INT?


> 2 - If the INTEGER_CST is negative, is the negative part only in one
> of the high or low fields, i.e. low is always unsigned and high is
> always signed? If not, how do I know if the constant is signed or
> unsigned?

Negative numbers are sign extended through both the high and low
fields.  That said, you need to look at the type of the constant to
know whether you have a negative number or a very large positive
number.


Isn't the type of the constant always integer_type? How can I know if it is negative or positive?

Ian


Thank you,


--
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]