This is the mail archive of the gcc-patches@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: Speedup int_bit_from_pos


Jan Hubicka <hubicka@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)?

Thanks for doing this BTW.

Richard


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