lkml.org 
[lkml]   [2022]   [May]   [19]   [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 04:26:26PM -0400, Kent Overstreet wrote:
> On Thu, May 19, 2022 at 11:21:41PM +0300, Andy Shevchenko wrote:
> > On Thu, May 19, 2022 at 01:24:00PM -0400, Kent Overstreet wrote:
> > > +void pr_human_readable_s64(struct printbuf *buf, s64 v)
> > > +{
> > > + if (v < 0)
> > > + pr_char(buf, '-');
> > > + pr_human_readable_u64(buf, abs(v));
> >
> > Wouldn't -v work?
>
> This is a bit terser

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)

> > > + * pr_human_readable_u64 - Print out a u64 according to printbuf unit options
> >
> > Have you ever compile this? We have kernel doc validator running when compiling
> > the code...
>
> Yes I have, but I've never seen the kernel doc validator - can you point me to
> something so I can get that working?

You have to run 'make W=1' to get it, so Andy is being a bit overly
harsh here. Most people use neither W=1, nor C=1.

\
 
 \ /
  Last update: 2022-05-19 23:13    [W:0.312 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site