Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1705093ybm; Sat, 30 May 2020 18:14:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy78sZMSJF9PTYkLCmW23Dw4fkmsatSX8BEg9fezp/CI0V4SWQe4+aU3VTinXmsWhAvXeLB X-Received: by 2002:aa7:cb94:: with SMTP id r20mr15417237edt.215.1590887649030; Sat, 30 May 2020 18:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590887649; cv=none; d=google.com; s=arc-20160816; b=bOTWBzXi94bMpCWZJLvtd2BsvwxdCHrpwDHvWv52UCjNqfxcysRcrEysORY2Ia9YqU aF7UZGbn9nQIo4tIs7tRWWngU09OL7FSteDe+o4BoIox1VBDYVDS2U9OdMxnSrXBr54U cO62DAJOEi+mDjQKC8WpB7XaN0c/BM3pWNXamIeazZ8XmVdYAKK2F/Nztph7OCZGqXKU OrZrNVpb4G1kmglE/+P20l0BpUBuAeTSLwevWWvADFrPLFXKofQIpj7IxuGvlaVJ+LC3 CctstTZCPz9q0PUSkCH6VBDCL0nxpu+uVzJJohi8aTQi45EIV3d1Sy7xajk2WjejBhup 55nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YrUMJm73ZwzzC/W/oEuS2gLBD11t/qt40SB7aK49T1o=; b=H29Hp275fIFAT9+3bo89YLy8sxPZNb+YNFLMdzkyY7SA29WkNH1onM2cZK8BE24p/M RrJHKguvx+r0MyQn3ga9rpAi2DXhzHG7JEDXuXuhmDGRzZ0soaTV3td9LD3WtZHVnvyY taI0WwQ2K1oO9Le5I2bPTewhc73ivIY5fPHIVcGynUQGRKgm+6jbPiHSrmxpQBFQoW3Y jszuNdQtOP9rlZlVF12ZBS9Vm8J0AO3JR4IKzYk798HUjqgkO2tCMaVy9cO5M9t3sZw8 aCvuV8tz5YAWL//yV3Uy9xuvWShBMyI1j5Y0JjIPnshUAzXb34fpD7NkAwwSfKwVfwFc GWmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IO4bvnPG; 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 w22si8355767ejb.729.2020.05.30.18.13.44; Sat, 30 May 2020 18:14:09 -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=IO4bvnPG; 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 S1729581AbgEaBLz (ORCPT + 99 others); Sat, 30 May 2020 21:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729356AbgEaBLz (ORCPT ); Sat, 30 May 2020 21:11:55 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A67E5C03E969; Sat, 30 May 2020 18:11:53 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id y18so3374030iow.3; Sat, 30 May 2020 18:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YrUMJm73ZwzzC/W/oEuS2gLBD11t/qt40SB7aK49T1o=; b=IO4bvnPGqPLbcJI6dJRkmQY8L+lFKPKe/NdaEYfuqiiXxtf20if7b9qbw7EnfZzDP1 ghy6+v4llD2fcVGy3xTQEvRD5/04wEUr0cYnGVFnJ11kOfc+0vkO/nVPucvr50w83Hct YBb6UPtLPpid1jfdR0W8XVjal769GuVWDD4OE1t46vxRrH3LQc0M9OGdWVyXBsYzMfk9 trzqWe/CU2qoLVWGssJ72TvYNjjADLFHcXJIl51pkfuIFxwQjlphcR734x598OlBRz9P DM1uuV8HiCuoHSgqHizOwNct99WKAq1h80eFL23gKJeLNd10Nt7syTqXv5IVqklHUl3N jT0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YrUMJm73ZwzzC/W/oEuS2gLBD11t/qt40SB7aK49T1o=; b=InwJKz/zd3NqZ5LFLTxUV7D2/d0bRW8mEreQBecBhX2AzPN7+YQ7QRIvJMrCimlM9q HCcDXkvYPC4IeriMUHXUZ2jHtspuUBoKeRSg3KV2YJ65yv+q9RwYzAxDncDlCGJNNj0+ SrQMvBS9yu/qpX6m3bM7nvX7+jU5bDI1apZakzg7Pbcm2GAxQ9gTuGMPA7NPP7ppT6sj ACTVj18E6MLoWB52iQcSu4+vy7hgOQS3uUFxPsJ+vAvj+GlUKpw2SGdvlDUYPXBWK2vJ +NEZ2V7/BiYkJqqKuChZABX1l2FZGtEUtx0yUkIV3kbW2k9530rRgclbo3LgZzRYXbRX SPDA== X-Gm-Message-State: AOAM531FN9yQ3yXby8LSwkV3QfFnA4MMz3Exf6x05uDUFhBQIIaA2PoX h/iHP2/0GnDaTGrQRtTIY2rt2oFPeNmSal/HK0k= X-Received: by 2002:a02:cc49:: with SMTP id i9mr6735852jaq.52.1590887513109; Sat, 30 May 2020 18:11:53 -0700 (PDT) MIME-Version: 1.0 References: <17cb2b080b9c4c36cf84436bc5690739590acc53.1590017578.git.syednwaris@gmail.com> <202005242236.NtfLt1Ae%lkp@intel.com> <20200529183824.GW1634618@smile.fi.intel.com> In-Reply-To: From: Syed Nayyar Waris Date: Sun, 31 May 2020 06:41:41 +0530 Message-ID: Subject: Re: [PATCH v7 1/4] bitops: Introduce the the for_each_set_clump macro To: Andy Shevchenko Cc: Andy Shevchenko , Linus Walleij , Andrew Morton , William Breathitt Gray , Arnd Bergmann , Linux-Arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 30, 2020 at 2:50 PM Andy Shevchenko wrote: > > On Sat, May 30, 2020 at 11:45 AM Syed Nayyar Waris wrote: > > On Sat, May 30, 2020 at 3:49 AM Andy Shevchenko > > wrote: > > ... > > > I am still investigating more on this. Let me know if you have any suggestions. > > As far as I understand the start pointers are implementations of abs() > macro followed by min()/max(). > I think in the latter case it's actually something which might help here. > > Sorry, right now I have no time to dive deeper. No Problem. Thank you for sharing your initial pointers. By the way, as I was working on it I found a way to avoid comparison with '0' in '__builtin_constant_p'. And because of this, no compilation warnings are getting produced. Change the following: #define GENMASK_INPUT_CHECK(h, l) \ (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ __builtin_constant_p((l) > (h)), (l) > (h), 0))) To this: #if (l) == 0 #define GENMASK_INPUT_CHECK(h, l) 0 #elif #define GENMASK_INPUT_CHECK(h, l) \ (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ __builtin_constant_p((l) > (h)), (l) > (h), 0))) #endif I have verified that this works. Basically this just avoids the sanity check when the 'lower' bound 'l' is zero. Let me know if it looks fine. Regarding min, max macro that you suggested I am also looking further into it. Regards Syed Nayyar Waris