> Jan Hubicka <hubi...@ucw.cz> writes:
> > +/* Like bit_position, but return as an integer.  It must be representable 
> > in
> > +   that way (since it could be a signed value, we don't have the
> > +   option of returning -1 like int_size_in_byte can.  */
> > +
> > +static inline HOST_WIDE_INT
> > +int_bit_position (const_tree field)
> > +{ 
> > +  return (wi::lrshift (wi::to_offset (DECL_FIELD_OFFSET (field)), 
> > BITS_PER_UNIT_LOG)
> > +     + wi::to_offset (DECL_FIELD_BIT_OFFSET (field))).to_shwi ();
> > +}
> 
> Should this be lshift (left shift) rather than lrshift (logical right shift)?

Yep, I noticed the bug and corrected it earlier.
I suppose it may be interesting to get coverage of GCC and looks for cases 
where we
invoke fold for doing constant arithmetic. int_bit_position is definitely not 
alone.

Honza
> 
> Thanks for doing this BTW.
> 
> Richard

Reply via email to