public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Dalecki <dalecki@evision-ventures.com>
To: Jakob Kemi <jakob.kemi@telia.com>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hex <-> int conversion routines.
Date: Tue, 19 Feb 2002 16:52:30 +0100	[thread overview]
Message-ID: <3C7274BE.1030803@evision-ventures.com> (raw)
In-Reply-To: <02021915240900.00635@jakob>

Jakob Kemi wrote:
> Hi,
> 
> When grepping through the kernel I noticed that there exists at least 27 
> (probably more with non-obvious names) different implementations of hex to
> int conversion functions. 2/3 of them in arch and the rest in drivers and fs.
> All implementations were variations of this function:

Fine...

> +static __inline__ int _hexint_byte(const char *src)
> +{

...

> +}

Not worth inlining. char conversion are seldomly time critical.


> +static __inline__ int hexint_nibble(char x)

Same applies here.

> +static __inline__ char inthex_nibble(int x)
> +{
> +	const char* digits = "0123456789abcdef";
> +
> +	return digits[x & 0x0f];
> +}

perhaps better do static const char *digits.

> +static __inline__ void inthex_byte(int x, char* dest)
> +{
> +	const char* digits = "0123456789abcdef";
> +
> +	dest[0] = digits[(x & 0xf0) >> 4];
> +	dest[1] = digits[x & 0x0f];
> +}

perhaps better do static const char *digits.

Regards.


  reply	other threads:[~2002-02-19 15:53 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 [this message]
2002-02-19 18:49   ` Jakob Kemi
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=3C7274BE.1030803@evision-ventures.com \
    --to=dalecki@evision-ventures.com \
    --cc=jakob.kemi@telia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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