Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932422AbbELL0z (ORCPT ); Tue, 12 May 2015 07:26:55 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:33418 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752972AbbELL0y (ORCPT ); Tue, 12 May 2015 07:26:54 -0400 From: Rasmus Villemoes To: "George Spelvin" Cc: joe@perches.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2 v2] lib/vsprintf.c: Further simplify uuid_string() Organization: D03 References: <1431396840.2884.40.camel@perches.com> <20150512091036.5773.qmail@ns.horizon.com> X-Hashcash: 1:20:150512:linux-kernel@vger.kernel.org::JB9FxxC2YO4/FRW1:0000000000000000000000000000000000Qnx X-Hashcash: 1:20:150512:joe@perches.com::/YGkrbdYwJfAXMrm:007X9x X-Hashcash: 1:20:150512:linux@horizon.com::edOoKPYOc7mrnrBy:00000000000000000000000000000000000000000000E/6o Date: Tue, 12 May 2015 13:26:50 +0200 In-Reply-To: <20150512091036.5773.qmail@ns.horizon.com> (George Spelvin's message of "12 May 2015 05:10:36 -0400") Message-ID: <87vbfy6nph.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1442 Lines: 41 On Tue, May 12 2015, "George Spelvin" wrote: > Make the endianness permutation table do double duty by having it > list not source offsets, but destination offsets. Thus, it both puts > the bytes in the right order and skips the hyphens. > > This further shrinks the code from 256 to 214 bytes. Eliminating > erratic branches probably helps speed, too. > > Signed-off-by: George Spelvin > --- >> These might be better with a little comment/explanation >> of the values as output offsets for each index. > > Like this? I had thought about it, and had decied not to change the > existing lacomic code style, as it didn't seem any harder to understand > than the original. But I'm happy to add comments. > With or without comments and the microscopic nit below: Acked-by: Rasmus Villemoes You may want/need to include Andrew Morton in the cc-list to get these picked up. > > lib/vsprintf.c | 32 ++++++++++++++------------------ > 1 file changed, 14 insertions(+), 18 deletions(-) > > + /* Insert the fixed punctuation */ > + uuid[23] = uuid[18] = uuid[13] = uuid[8] = '-'; > + uuid[36] = 0; I think '\0' is more common. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/