linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kstrtox: reuse functions from ctype.h
Date: Fri, 15 Apr 2011 23:51:48 +0300	[thread overview]
Message-ID: <20110415205148.GA6132@p183> (raw)
In-Reply-To: <op.vtxmkrzr3l0zgt@mnazarewicz-glaptop>

On Thu, Apr 14, 2011 at 04:30:17PM +0200, Michal Nazarewicz wrote:
> On Thu, 14 Apr 2011 16:06:34 +0200, Alexey Dobriyan <adobriyan@gmail.com>  
> wrote:

> >> @@ -47,8 +42,8 @@ static int _kstrtoull(const char *s, unsigned int  
> >> base, unsigned long long *res)
> >>
> >>                if ('0' <= *s && *s <= '9')
> >>                        val = *s - '0';
> >> -               else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
> >> -                       val = _tolower(*s) - 'a' + 10;
> >> +               else if (isxdigit(*s))
> >
> > [0-9] are isxdigit() as well, so the code sort of logically duplicate.
> 
> Yes, so? ;)
> 
> I think isxdigit(*s) looks nicer than “'a' <= _tolower(*s) &&
> _tolower(*s) <= 'f'”.

If you write isxdigit(*s) you have to write some other expression for
"val = " to be nicer.

The point it's doesn't matter, compiler will optimize all those _tolower().

      reply	other threads:[~2011-04-15 20:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 13:34 [PATCH] kstrtox: reuse functions from ctype.h Michal Nazarewicz
2011-04-14 14:06 ` Alexey Dobriyan
2011-04-14 14:30   ` Michal Nazarewicz
2011-04-15 20:51     ` Alexey Dobriyan [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=20110415205148.GA6132@p183 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mina86@mina86.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).