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: [patch] (X << C) >> C folding


On Sun, Jun 12, 2005 at 01:58:07PM -0400, James A. Morrison wrote:
> 	* fold-const (fold_binary): Transform (X << C) >> C into X & (-1>>C)
> 	for unsigned types.

Not ok.  The correct mask has C 0 bits at the top AND bottom.  So, 
for instance with C=4, MASK=0x0ffffff0 for a 32-bit type.


r~


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