[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20180627173911.GS30877@mtr-leonro.mtl.com>
Date: Wed, 27 Jun 2018 20:39:11 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Jason Gunthorpe <jgg@...lanox.com>,
Doug Ledford <dledford@...hat.com>,
Kees Cook <keescook@...omium.org>,
RDMA mailing list <linux-rdma@...r.kernel.org>,
Hadar Hen Zion <hadarh@...lanox.com>,
Matan Barak <matanb@...lanox.com>,
Michael J Ruhl <michael.j.ruhl@...el.com>,
Noa Osherovich <noaos@...lanox.com>,
Raed Salem <raeds@...lanox.com>,
Yishai Hadas <yishaih@...lanox.com>,
Saeed Mahameed <saeedm@...lanox.com>,
linux-netdev <netdev@...r.kernel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH rdma-next 08/12] overflow.h: Add arithmetic shift helper
On Wed, Jun 27, 2018 at 11:36:03AM +0200, Rasmus Villemoes wrote:
> On 26 June 2018 at 19:54, Jason Gunthorpe <jgg@...lanox.com> wrote:
>
> > On Tue, Jun 26, 2018 at 10:07:07AM +0200, Rasmus Villemoes wrote:
> > > On 25 June 2018 at 19:11, Jason Gunthorpe <[1]jgg@...lanox.com>
> > wrote:
> > >
> >
> > When thinking about signed cases.. The explicit u64 cast, and
> > implict promotion to typeof(d), produce something counter intuitive,
> > eg:
> >
> > (u64)(s32)-1 == 0xffffffffffffffff
> >
> > Which would result in a shift oucome that is not what anyone would
> > expect, IMHO... So the first version isn't what I'd expect either..
> >
>
> Wouldn't check_shift_overflow(-1, 4, &someint) just put -16 in someint and
> report no overflow? That's what I'd expect, if negative values are to be
> supported at all.
Most if not all the times we don't do shifts on negative values, so I
don't think that we should support them.
Thanks
Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)
Powered by blists - more mailing lists