Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1127427ybs; Mon, 25 May 2020 07:46:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrRffwafVnJe9ySytCp6gc6Zr0yMhheaBCeBk+apAWYuA5DLLLbUBmt3pPq2JOR+a6nOvF X-Received: by 2002:a05:6402:30b2:: with SMTP id df18mr15126955edb.323.1590417985988; Mon, 25 May 2020 07:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590417985; cv=none; d=google.com; s=arc-20160816; b=ldNQyfJqqgyZ23B2xgsMmyKvO49UgZK4Qwdpa+Idar70FvoEIPviXNVzcWvU8coMdJ Uqh6Ixb0PxCTw7JEkxmno4RNgaHaFpo4Oj3GqBEQRLWy9uiD1PjzhyK2Rv1AfrhOpAdc rIkzwwV0F5x/f1dkW6vGw/ncY84S6wD5YXTpC0fW/zBoEhuntzgfD1SDAqzpoKMcaGDm TcNnKfbGDeNL3S2v+IlOnfIi0iaqJ0s6IJcCzqfxzRm5Qy5HGB6HNeIJaD54HlrVndVF 5mRtBJHUoT23Q/mZeaIPQrX6WUElMFvCrHAB2nmj9rrQT4z4zw2f25xEyWr+w4W7d+cH wgnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=2r86WacDGnUCOO6WwYKfUAcxSZc3UkZYsl//tDZGyco=; b=Hy73WKgbg4v9Ofoj5ZZsKDEq7VjmnD/gph89MOWdexL8yLObFkVfcVdaa/OOhFVaXB QwDoTKkXclV7O3+fOqDGgkgMcztSkbdIPPeDX1llnBBsDLEEks5RGrL77t+BL0bas8Mb bik7rIxeVe7JFzb3/JG0odi1mjLXCwb7jYRJMT+OgspMTCLWhZ24le8g/r5sr3uPeXuo QgahmdmbMY7uskm5gOUtH7rILD0R/NcyJIh6vIaqE5jCMtjhS7xdVIgTkyL//33mRFs9 SWwLxhWFRNLD45J26caPPoTVIG0SLqd6yP2sNgiKgabF5faDgUN87taYQ3OdZsSo1mP0 bdxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TIpFkyqr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si9161609edx.506.2020.05.25.07.46.03; Mon, 25 May 2020 07:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TIpFkyqr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390935AbgEYOnP (ORCPT + 99 others); Mon, 25 May 2020 10:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390911AbgEYOnP (ORCPT ); Mon, 25 May 2020 10:43:15 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF16C061A0E for ; Mon, 25 May 2020 07:43:15 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id n24so20714695ejd.0 for ; Mon, 25 May 2020 07:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2r86WacDGnUCOO6WwYKfUAcxSZc3UkZYsl//tDZGyco=; b=TIpFkyqrsZozNMDnMDecOEO1Kwr52zfLkT29smqMJ458sFuesfF+NlDp8nWPP3iKNY iQ3pbZI56DUArWx6cGULkb9ds6Oa41l7CgEefz/eLpkX9rciOtBx0bMMNFFdtMgz01qA XZ6BuMg7m+ExGPHJuMbQXEZJtbtyykWN3zO3IxAZDIV73FdChDTKS5XkvKXdUw67xleK fOt5TzJh/hm1anIY79rREZTfdiZdVAbcojzu8+j29dLxFIHqhWXOagMeGOpi3VyugB/k qiIw823HQEve7OEBJaZwp1cwzLrYXLMLTn1kBdxESnkAgT7EsRROvebutkd4YLhfWez8 vfWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=2r86WacDGnUCOO6WwYKfUAcxSZc3UkZYsl//tDZGyco=; b=Mwp2f/Ey5JHQZmwSkYaEt3FnJozGX8K3MSdQ9hdupL2rIP5wVcItEyfmvS4hdQ8uAy dZqI9cJm3JIlsULy8S2sEZPj5Yx2fi55EmokDJURw6lvEphgnf59ePbnsEpmVDvHt0gs VRQMKhqLurZ3MLY6Ik0ag3aVPD8DY8Pz/r+8g0gRIyV1lEPtP7GDrxca/d9KvtidrWSR LSwlerEbU9FQiklwXnuVzMj1A6Z2D+T/kCR2aAgtqzu670XE1TVd6IFDg3HSzycRtJ1i 9uTezwxZy5PlByHPNTJD4zSu3oDjfi4LoeO1MrrtNMbiRYQoJpdqAgqLKmDrXFkvXL9/ Ff+g== X-Gm-Message-State: AOAM533CEMFkuvaBPOjXhk6Jp+xgt0KCLEvV2YitNHyoPBdSyE6grQAD d/Bir/OOooV+UVsltumc1D4= X-Received: by 2002:a17:906:4e87:: with SMTP id v7mr18526978eju.384.1590417794085; Mon, 25 May 2020 07:43:14 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id h25sm15826846ejx.7.2020.05.25.07.43.13 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 May 2020 07:43:13 -0700 (PDT) Date: Mon, 25 May 2020 14:43:12 +0000 From: Wei Yang To: Andy Shevchenko Cc: Wei Yang , akpm@linux-foundation.org, christian.brauner@ubuntu.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bitops: simplify get_count_order_long() Message-ID: <20200525144312.mbw2z3ydncyasvss@master> Reply-To: Wei Yang References: <20200524123551.9469-1-richard.weiyang@gmail.com> <20200525091458.GK1634618@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200525091458.GK1634618@smile.fi.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 25, 2020 at 12:14:58PM +0300, Andy Shevchenko wrote: >On Sun, May 24, 2020 at 12:35:51PM +0000, Wei Yang wrote: >> These two cases could be unified into one. > >Care to provide a test case which supports your change? > Hmm.. where should I put the test? tools/testing/selftests/ ? >> Signed-off-by: Wei Yang >> --- >> include/linux/bitops.h | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/include/linux/bitops.h b/include/linux/bitops.h >> index 9acf654f0b19..5b5609e81a84 100644 >> --- a/include/linux/bitops.h >> +++ b/include/linux/bitops.h >> @@ -206,10 +206,7 @@ static inline int get_count_order_long(unsigned long l) >> { >> if (l == 0UL) >> return -1; >> - else if (l & (l - 1UL)) >> - return (int)fls_long(l); >> - else >> - return (int)fls_long(l) - 1; >> + return (int)fls_long(--l); >> } > >-- >With Best Regards, >Andy Shevchenko > -- Wei Yang Help you, Help me