Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932066AbbELCOJ (ORCPT ); Mon, 11 May 2015 22:14:09 -0400 Received: from smtprelay0138.hostedemail.com ([216.40.44.138]:40036 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752086AbbELCOE (ORCPT ); Mon, 11 May 2015 22:14:04 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2526:2559:2562:2731:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3868:3870:3872:4321:4362:5007:6261:7903:9010:10004:10400:10848:11232:11473:11658:11914:12043:12296:12517:12519:12683:12740:13019:13069:13161:13229:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: love41_7a8055d1fb553 X-Filterd-Recvd-Size: 1789 Message-ID: <1431396840.2884.40.camel@perches.com> Subject: Re: [PATCH 2/2] lib/vsprintf.c: Further simplify uuid_string() From: Joe Perches To: George Spelvin Cc: linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org Date: Mon, 11 May 2015 19:14:00 -0700 In-Reply-To: <20150511195501.3772.qmail@ns.horizon.com> References: <20150511195501.3772.qmail@ns.horizon.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1231 Lines: 30 On Mon, 2015-05-11 at 15:55 -0400, 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. Thanks George. One minor nit maybe not worth updating. > diff --git a/lib/vsprintf.c b/lib/vsprintf.c [] > @@ -1265,10 +1265,9 @@ char *uuid_string(char *buf, char *end, const u8 *addr, > struct printf_spec spec, const char *fmt) > { > char uuid[sizeof("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")]; > - char *p = uuid; > int i; > - static const u8 be[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; > - static const u8 le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; > + static const u8 be[16] = {0,2,4,6,9,11,14,16,19,21,24,26,28,30,32,34}; > + static const u8 le[16] = {6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34}; These might be better with a little comment/explanation of the values as output offsets for each index. -- 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/