RE: [PATCH 1/3] usb: cdns3: gadget: suspicious implicit sign extension

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

 



 
> That's a separate issue.  I believe (but haven't checked) that the << operator
> has lower precedence than +, so the compiler interprets the expression as:
> 
> unsigned int k = 0x80 << (24 + 0x81);
> 
> and it's pretty obvious why this causes an error.  Instead, try
> compiling:
> 
> unsigned int k = (0x80 << 24) + 0x81;
> 
> You may get an error message about signed-integer overflow, but not about
> shift-count overflow.
> 

Hi Alan,

Your analysis is correct, I did not check the warning message correctly.

Peter




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux