From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: torvalds@linux-foundation.org, linux@rasmusvillemoes.dk,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [patch 069/104] lib/string_helpers.c:string_get_size(): remove redundant prefixes
Date: Fri, 13 Feb 2015 20:03:40 -0800 [thread overview]
Message-ID: <1423886620.10229.10.camel@HansenPartnership.com> (raw)
In-Reply-To: <20150213170246.9c52ad2a.akpm@linux-foundation.org>
On Fri, 2015-02-13 at 17:02 -0800, Andrew Morton wrote:
> On Fri, 13 Feb 2015 16:05:54 -0800 James Bottomley <James.Bottomley@hansenpartnership.com> wrote:
>
> > @@ -42,31 +44,60 @@ void string_get_size(u64 size, const enum string_size_units units,
> > [STRING_UNITS_2] = 1024,
> > };
> > int i, j;
> > - u32 remainder = 0, sf_cap;
> > + u32 remainder = 0, sf_cap, exp;
> > char tmp[8];
> > + const char *unit;
> >
> > tmp[0] = '\0';
> > i = 0;
> > + if (!size)
> > + goto out;
>
> whitespace wart.
Yes, I'll run it through checkpatch before submitting.
> > + if (blk_size >= divisor[units]) {
> > + while (blk_size >= divisor[units]) {
> > + remainder = do_div(blk_size, divisor[units]);
> > + i++;
> > + }
> > + }
>
> The `if' doesn't do anything.
Right ... I just copied from the original, but it's true we can unwrap
this.
> > + exp = divisor[units];
> > + do_div(exp, blk_size);
> > + if (size >= exp) {
> > + remainder = do_div(size, divisor[units]);
> > + remainder *= blk_size;
> > + i++;
> > + } else {
> > + remainder *= size;
> > + }
> > + size *= blk_size;
> > + size += (remainder/divisor[units]);
> > + remainder %= divisor[units];
> > +
> > if (size >= divisor[units]) {
> > while (size >= divisor[units]) {
> > remainder = do_div(size, divisor[units]);
> > i++;
> > }
> > + }
>
> Here too.
Certainly,
James
prev parent reply other threads:[~2015-02-14 4:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <54dd30d9.8sIvA5PVH18vSWTI%akpm@linux-foundation.org>
2015-02-12 23:25 ` [patch 069/104] lib/string_helpers.c:string_get_size(): remove redundant prefixes James Bottomley
2015-02-12 23:40 ` Andrew Morton
2015-02-12 23:45 ` James Bottomley
2015-02-12 23:55 ` Andrew Morton
2015-02-14 0:05 ` James Bottomley
2015-02-14 1:02 ` Andrew Morton
2015-02-14 4:03 ` James Bottomley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423886620.10229.10.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.