[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH7mPvgqLf5x5QvdP1u1hpJCD+p2vy3aj=nt0RsHQH+aKTdovA@mail.gmail.com>
Date: Sat, 23 Dec 2017 22:28:37 -0500
From: Nick Desaulniers <nick.desaulniers@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Minchan Kim <minchan@...nel.org>, Nitin Gupta <ngupta@...are.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-mm@...ck.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] zsmalloc: use U suffix for negative literals being shifted
On Sat, Dec 23, 2017 at 10:24 PM, Matthew Wilcox <willy@...radead.org> wrote:
> On Sat, Dec 23, 2017 at 09:33:40PM -0500, Nick Desaulniers wrote:
>> Fixes warnings about shifting unsigned literals being undefined
>> behavior.
>
> Do you mean signed literals?
A sorry, s/unsigned/negative signed/g. The warning is:
mm/zsmalloc.c:1059:20: warning: shifting a negative signed value is undefined
[-Wshift-negative-value]
link->next = -1 << OBJ_TAG_BITS;
~~ ^
>
>> */
>> - link->next = -1 << OBJ_TAG_BITS;
>> + link->next = -1U << OBJ_TAG_BITS;
>> }
>
> I don't understand what -1U means. Seems like a contradiction in terms,
> a negative unsigned number. Is this supposed to be ~0U?
$ ag \\-1U[^L]
The code base is full of that literal. I think of it as:
(unsigned) -1
Powered by blists - more mailing lists