On Wed, Jun 27, 2018 at 11:36:03AM +0200, Rasmus Villemoes wrote:
On 26 June 2018 at 19:54, Jason Gunthorpe [off-list ref] wrote:
quoted
On Tue, Jun 26, 2018 at 10:07:07AM +0200, Rasmus Villemoes wrote:
quoted
On 25 June 2018 at 19:11, Jason Gunthorpe <[1]jgg@mellanox.com>
wrote:
quoted
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