Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp82391ima; Thu, 14 Mar 2019 20:37:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHEYOyzrIL7xkG+W+pA+wvrQb7WDtXGSnXe+zstFEXRYFA7YGseiSzkLyx9EDlmy2boLGm X-Received: by 2002:a17:902:6804:: with SMTP id h4mr1848990plk.115.1552621053494; Thu, 14 Mar 2019 20:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552621053; cv=none; d=google.com; s=arc-20160816; b=GCZKwfIwTZYG81Sg8wc9TnT6FY2fon5RNNxdvqjUERdgPNyyteEsHItYmS6XuaVq2+ qo5CDZ9YZ3APJNxay1kAJx++GtfFLktdIOmnLbjEfmLB4iHH3AWYpsE30FrWTdbZsGf2 BOJVYKPdCm3mUw8einTz0hOpsehbqNiI7Iac+m+LbcsWOplgJTIJRSXz3ByKaysQQuap bUEweS9HlPRJqHD9CmEJQJ8Xe/QVjRYblDcoZrUPm1/XcxeaHK8JmxoHUhPGvnAQT8N5 U9JyfrSQWSiNP4YWS/jP/z6k8FUXDkV6bNTxkFx6nxPwCMU+HQIjihM76CDR/ZIKt2DL +jcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:cc:subject:to :message-id:from:date; bh=dUb63X+jJGE/oKh7jWdzja3SzjQWSmIXTJ01OEia1Ps=; b=TXHU8QwZv8y2DqdoDzmlos0yNX+V/8hBRU8o0aNwOUC0v6tsgOH2KDQeKpdmo57Tvv sK7rQRzozvpWExSEhcJLYa0v3k0ClekyolWFQnnqtvNv3Z8fefxeXXa9G/hBtb9YFTtS Wo0Pi+ZXmK3WRMkr6pks+vEUHw0YpYM7qJHWMNRJgvG3N8n7nKNoyjPxjH7rcdj1V//w bcqMeQDE5jWxzav17J2XEt5XG+GItkKDoG9Yyl+if8u3SSE+AfnvL/etprOXdQ/YHxDj 4iPn9MU0W2EaWUBgAGUxjoSnXrojEaRbVOQ+SRTNPtwQlFvhPQ0mNfd+Iu9kaIhjmCbC ohcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si841121pgf.160.2019.03.14.20.37.18; Thu, 14 Mar 2019 20:37:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727133AbfCODgn (ORCPT + 99 others); Thu, 14 Mar 2019 23:36:43 -0400 Received: from mx.sdf.org ([205.166.94.20]:51241 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfCODgn (ORCPT ); Thu, 14 Mar 2019 23:36:43 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id x2F3ZVwU004274 (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits) verified NO); Fri, 15 Mar 2019 03:35:31 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id x2F3ZUgS024157; Fri, 15 Mar 2019 03:35:30 GMT Date: Fri, 15 Mar 2019 03:35:30 GMT From: George Spelvin Message-Id: <201903150335.x2F3ZUgS024157@sdf.org> To: andriy.shevchenko@linux.intel.com, lkml@sdf.org, st5pub@yandex.ru Subject: Re: [PATCH 1/5] lib/sort: Make swap functions more generic Cc: akpm@linux-foundation.org, daniel.wagner@siemens.com, dchinner@redhat.com, don.mullis@gmail.com, geert@linux-m68k.org, linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk In-Reply-To: <1145741552593595@sas2-2074c606c35d.qloud-c.yandex.net> References: , , <20190309140653.GO9224@smile.fi.intel.com>, <201903091553.x29FrfMR018600@sdf.org>, <20190314092958.GV9224@smile.fi.intel.com>, <201903141009.x2EA9q1Z025888@sdf.org>, , <201903141153.x2EBrtKi000133@sdf.org>, <20190314121811.GY9224@smile.fi.intel.com>, <1145741552593595@sas2-2074c606c35d.qloud-c.yandex.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> swap_bytes / swap_4byte_words / swap_8byte_words >> swap_bytes / swap_ints / swap_longs >> swap_1 / swap_4 / swap_8 >> Pistols at dawn? On Thu, 14 Mar 2019 at 22:59:55 +0300, Andrey Abramov wrote: > Yes, in my opinion, swap_bytes / swap_ints / swap_longs are the > most readable because we have both swap_ints and swap_longs functions > (in one file near each other), so I don't think that there will be > any confusion about size. Yes, that's what I thought. They're three related but different functions, suffixed _bytes, _ints, and _longs. What could the difference possibly be? And if anyone has any lingering doubts, the functions are right there, with exquisitely clear comments. No to mention where they're used. Is "is_aligned(base, size, 8)" remotely obscure? Especially in context: if (is_aligned(base, size, 8)) swap_func = swap_longs; else if (is_aligned(base, size, 4)) swap_func = swap_ints; else swap_func = swap_bytes; What subtle and mysterious code. > But actually, it doesn't matter which name will you take, because > the meaning of each, in my opinion, is obvious enough, so I don't > mind about any of these options. I'm just amazed that this piece of bikeshedding is the most contentious thing about the patch series. I mean, if I'd named them: llanfairpwllgwyngyll() shravanabelagola() zheleznodorozhny() or peckish() esuriant() hungry() then yes, those would be bad names. I prefer the shorter _ints and _longs names, but this is just not a hill I want to die on.