[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220520044034.gdmip5whu5cdv6ir@moria.home.lan>
Date: Fri, 20 May 2022 00:40:34 -0400
From: Kent Overstreet <kent.overstreet@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-mm@...r.kernel.org,
pmladek@...e.com, rostedt@...dmis.org, senozhatsky@...omium.org
Subject: Re: [PATCH v2 07/28] lib/printbuf: Unit specifiers
On Thu, May 19, 2022 at 10:11:40PM +0100, Matthew Wilcox wrote:
> How about:
>
> if (v < 0) {
> pr_char(buf, '-');
> v = -v;
> }
> pr_human_readable_u64(buf, v);
>
> (some pedantic compilers might warn about the behaviour of S64_MIN, but
> I think we're OK)
Yes, since S64_MAX == -S64_MIN and S64_MIN == S64_MAX + 1, the code is correct
for v == S64_MIN.
But I still prefer my way :)
Powered by blists - more mailing lists