lkml.org 
[lkml]   [2022]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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 :)

\
 
 \ /
  Last update: 2022-05-20 06:41    [W:0.127 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site