RE: Understanding integer_cst

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the reply. 

I thought TREE_INT_CST_HIGH represented the high part of the integer
when taken on 4 bits
i.e 5 = 0|1|0|1 with high part = 0|1 and low part = 0|1. The high and
low parts are then spread into 4 bits...

Does your expectation mean that TREE_INT_CST_HIGHs purpose is solely as
a sign indicator or does this indicate that 16 can also be repesented
even though sixteen would not fit in HOST_BITS_PER_WIDE_INT bits?

Regards,

Primrose




<From: Ian Lance Taylor [mailto:ian@xxxxxxxx] >

>Why do you think TREE_INT_CST_HIGH would be 0|0|0|1 in your example?

>I would expect

>TREE_INT_CST_HIGH = 0|0|0|0
>TREE_INT_CST_LOW  = 0|1|0|1

>Ian

<Primrose.Mbanefo@xxxxxxxxxxxx> writes:

>> I do not understand the gcc internal documentation on the integer_cst

>> expression trees.
>> An expression is given to calculate the value of the constant:
>> 
>> ( (TREE_INT_CST_HIGH(e) << HOST_BITS_PER_WIDE_INT)
>> + TREE_INT_CST_LOW(e))
>> 
>> Using the expression, what is wrong in the following example:
>> 
>> Example
>> -----------
>> Given integer = 5
>> HOST_BITS_PER_WIDE_INT = 4 //just an example HOST_WIDE_INT is a type 
>> for which the integers are HOST_BITS_PER_WIDE_INT bits long.
>> 
>> Binary representation of given integer is 0|1|0|1 TREE_INT_CST_HIGH =

>> 0|0|0|1 TREE_INT_CST_LOW = 0|0|0|1
>> -----------
>> 
>> This definitely does not yield 5 if I apply that expression, so, I 
>> imagine there is something wrong somewhere.
>> If it does, then maybe I did not understand the expression?
>> 
>> Could anybody please tell me where my thinking went wrong?


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux