From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752393AbYEMQyP (ORCPT ); Tue, 13 May 2008 12:54:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760400AbYEMQxe (ORCPT ); Tue, 13 May 2008 12:53:34 -0400 Received: from rn-out-0910.google.com ([64.233.170.184]:46988 "EHLO rn-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760356AbYEMQxb (ORCPT ); Tue, 13 May 2008 12:53:31 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=OT7+OuHUbpscN8VBBrT+dv1G67zyvvjwEODYaY+vB5seBqgRoY1aoCGy24xDS63/HAl4xMkJurl5JUpd8YdhbXLwNfluSJBQUiG/vKvp1hoOZGbDwYG65hAOFcSGndvmCdZEs3PJKv1llRYtOpdvJ1SvukaUWGI8Lvh8J//c5eU= Subject: Re: [PATCH 01/12] lib: create common ascii hex array From: Harvey Harrison To: Ilpo =?ISO-8859-1?Q?J=E4rvinen?= Cc: Andrew Morton , LKML , James Bottomley , linux-scsi , Bartlomiej Zolnierkiewicz , linux-ide , linux-netdev , David Miller , Jeff Garzik , Ingo Molnar , Jason Wessel , David Howells , "ralf@linux-mips.org" , Paul Mundt , Paul Mackerras In-Reply-To: References: <1210619134.24092.51.camel@brick> Content-Type: text/plain; charset=utf-8 Date: Tue, 13 May 2008 09:53:27 -0700 Message-Id: <1210697607.5938.1.camel@brick> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1.1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2008-05-13 at 12:55 +0300, Ilpo Järvinen wrote: > On Mon, 12 May 2008, Harvey Harrison wrote: > > > Add a common hex array in hexdump.c so everyone can use it. > > > > Add a common hi/lo helper to avoid the shifting masking that is > > done to get the upper and lower nibbles of a byte value. > > > > Pull the pack_hex_byte helper from kgdb as it is opencoded many > > places in the tree that will be consolidated. > > > > Signed-off-by: Harvey Harrison > > --- > > > > -#define hex_asc(x) "0123456789abcdef"[x] > > + > > +extern const char hex_asc[]; > > +#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] > > +#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] > > + > > +static inline char *pack_hex_byte(char *buf, u8 byte) > > +{ > > + *buf++ = hex_asc_hi(byte); > > + *buf++ = hex_asc_lo(byte); > > + return buf; > > +} > > Any idea how much this will bloat kernel once it has, lets say 100 > users? 5k, 10k? > No more than the existing users do open-coding the same thing all over the place. If it becomes a problem, this can be out-of-lined, but the savings are not much. Harvey