Re: [PATCH v2 07/28] lib/printbuf: Unit specifiers

From: Kent Overstreet
Date: Fri May 20 2022 - 00:40:42 EST


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 :)