Re: [PATCH rdma-next v1 1/3] overflow.h: Add arithmetic shift helper

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

 



On Sun, Jul 08, 2018 at 09:17:07PM +0000, Bart Van Assche wrote:
> On Sun, 2018-07-08 at 12:42 -0600, Jason Gunthorpe wrote:
> > On Sun, Jul 08, 2018 at 03:31:45PM +0000, Bart Van Assche wrote:
> > > On Sun, 2018-07-08 at 13:38 +0300, Leon Romanovsky wrote:
> > > > + * - 'a << s' sets the sign bit, if any, in '*d'
> > >
> > > Setting the highest bit is fine if a is unsigned.
> >
> > No, it isn't, it makes 'd' negative, which is to be considered an overflow.
>
> How could an *unsigned* number ever be negative? Please clarify.

Better to say, that "unsigned d" overflow is checked with "(*_d >>
_to_shift) != _a)" check.

Thanks

>
> Thanks,
>
> Bart.
>
>
>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux