All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakob Kemi <jakob.kemi@telia.com>
To: Martin Dalecki <dalecki@evision-ventures.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hex <-> int conversion routines.
Date: Tue, 19 Feb 2002 19:49:32 +0100	[thread overview]
Message-ID: <02021919493204.00447@jakob> (raw)
In-Reply-To: <02021915240900.00635@jakob> <3C7274BE.1030803@evision-ventures.com>
In-Reply-To: <3C7274BE.1030803@evision-ventures.com>

> > +static __inline__ int _hexint_byte(const char *src)
> > +{
>
> ...
>
> > +}
>
> Not worth inlining. char conversion are seldomly time critical.
ok, I removed the inline version.

> > +static __inline__ int hexint_nibble(char x)
>
> Same applies here.
I added a tiny function, __hexint_nibble() which doesn't do error checking.
it's very small and can be used inline if needed.

> > +static __inline__ char inthex_nibble(int x)
> > +{
> > +	const char* digits = "0123456789abcdef";
> > +
> > +	return digits[x & 0x0f];
> > +}
>
> perhaps better do static const char *digits.
GCC doesn't copy const strings, as opposed to other const arrays.
So it should be fine as it is. GCC also reuse duplicated strings.

Regards,
	Jakob Kemi

  reply	other threads:[~2002-02-19 18:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-19 15:39 [PATCH] hex <-> int conversion routines Jakob Kemi
2002-02-19 15:52 ` Martin Dalecki
2002-02-19 18:49   ` Jakob Kemi [this message]
2002-02-19 19:02     ` Bernd Petrovitsch
2002-02-19 20:27       ` H. Peter Anvin
2002-02-23  2:30         ` Ian Molton
2002-02-19 19:04     ` H. Peter Anvin
2002-02-20 10:25     ` Martin Dalecki
2002-02-19 16:51 ` Richard B. Johnson
2002-02-19 18:02 ` Linus Torvalds
2002-02-19 20:29   ` george anzinger

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=02021919493204.00447@jakob \
    --to=jakob.kemi@telia.com \
    --cc=dalecki@evision-ventures.com \
    --cc=linux-kernel@vger.kernel.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.