Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2101514pxk; Sat, 3 Oct 2020 08:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNr9+6mpUGeWm3gEXd01trepSorY8GlxNXdBMwTPTQwnlbqAO2GBJscD0uM5xrgjEMmQ+4 X-Received: by 2002:a17:906:86c3:: with SMTP id j3mr1272687ejy.493.1601737837814; Sat, 03 Oct 2020 08:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601737837; cv=none; d=google.com; s=arc-20160816; b=WHBSifq3xNpsFLfXE3dEphd9NmvyNwqabkA9dXPqpX9fKQD88mQjidkG96lSwBixEh fDiKwHS7vrLe8DfbTVq2OefWMs1H28tpq1FBZgCoCFDDCng1upRWFArs8nW6CRHe/PFt 4HQli89u1DpuORL+fjP0dxUv/e4Y2lexReuXpH51JUyHblzN6M9xWD11AdpXGZcWgR7q RMEfs+w7CWPeb78DzRO2YVlPrMCl9II8dhbe1Mi972kP6OrcPTDIy8So6jA6WZZM4bFY MTvsU3GRFSmIecOXwaiwpesXbSgjVpcpZ0Sq0NK6AULgzz38RNHTrYl3kM/8fRISBZYV Dy7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fOUbPAOj/ENg2re+6PqsOMWC7kbWB8MQWVQQDZeWHvI=; b=ZMPpfPjToMVRSezM+WBeq+ZaL8hQvqp7j2Qf2tr9EBDIBOzh1TRWo8uOV620s/CTw+ Qwmdh5k2yoJp4vWfzPljr1qCytKuW1ZR6f18cv3gJPlYyGtnz9ZPKVZujFi4BVs0dWx/ kDd27Dryj6KrTbXgpxmB+byxW0cPIkx0vDqCSMDG00a3/nA7TM71YdS76rRE4cEfXp0l kmSTCyrSAwRnIwYFNgjMUHW3e6K0maPvpi0k0suOigRkLAUQiXtqX6FaM6E7O4HiOUS9 dkzj2qYL/t73l286ttbyOhe0dMAepMYLa9YSvAaF2lGCv9Oimqvk7XmNNvFwA3onW30j KtZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=spvRBPSQ; 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 12si3360181ejy.241.2020.10.03.08.10.14; Sat, 03 Oct 2020 08:10:37 -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=spvRBPSQ; 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 S1725794AbgJCPI3 (ORCPT + 99 others); Sat, 3 Oct 2020 11:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbgJCPI2 (ORCPT ); Sat, 3 Oct 2020 11:08:28 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B29BCC0613D0; Sat, 3 Oct 2020 08:08:27 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id q5so3930273ilj.1; Sat, 03 Oct 2020 08:08:27 -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=fOUbPAOj/ENg2re+6PqsOMWC7kbWB8MQWVQQDZeWHvI=; b=spvRBPSQW3AcFZz47CrtOVZa/uAQ6+ZnEEzhf4ewEMcTvv/P+EUNluBmEjDPD7eEWB kkN1ATsN6wAYh+R9vhMgWUvQ0pQRjTPgtuKOdAfpQPCXK1DCcb7dxMlhniekhEu0U5Mi zPEHUm5xLXx22Kwc0Pz5NnU4OfPd+gEUxswMKlTQbKjOPr+HsByB1BoIjpIsUXeNQWSD FZ0z0ALCytCvxg1mXqgVD7QoNXjXwVLdE8fa/G2MqWLzXOLiOBu0YvAGRRnqN38ti/El PiyvDiboDXDMgJNuzHz83p1eGlfRuoANig87hdTsGpvB9RgZ0U9KlucaGhkn/10CAskx QiVw== 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=fOUbPAOj/ENg2re+6PqsOMWC7kbWB8MQWVQQDZeWHvI=; b=inl0A6lIvESJmasF7fGWM8Lf4el8KgX2JvKDyZJ+g+SA5WUlWu+pA9ldf9ocksG0uV RhI6W6PUb3PBBdxcRgpbaCmmQcYKUTEYl3TZzbgCs6Mz92gFMrg9mSRJ1mUU22qfdduY 0b7BaSkEjoyNeKJd3KrgSWa6jDQLbDgNIxHz9e5zlEczbuZLqyXE3gCgv5XuWcfaKl9A 1tWTOsdT5axf7jMgggFvXf/ISlWixUUSYH0ER2Dg9zPlWjRbMaQ/5CJy0zPwmElVwz6S ekMrck3I2H34v+Zvy2HVSivvOQ72LISUE8vwbktpsbFpzbAloMGR2WyxODGfRmO4x+ui yjIw== X-Gm-Message-State: AOAM531E7j/IRdcl9hjN2+VoTgjokAqhJDaPoN9DT0YTctvwzXNqiM3k 7GC/85Ygrn/GDepZQ6ZqHHnO2OLzzAT+sdqd7VKm9oKv+aU= X-Received: by 2002:a92:790b:: with SMTP id u11mr6147817ilc.13.1601737706985; Sat, 03 Oct 2020 08:08:26 -0700 (PDT) MIME-Version: 1.0 References: <20201003125626.GA3732@shinobu> In-Reply-To: From: Syed Nayyar Waris Date: Sat, 3 Oct 2020 20:38:14 +0530 Message-ID: Subject: Re: [PATCH v10 1/4] bitops: Introduce the for_each_set_clump macro To: Andy Shevchenko Cc: William Breathitt Gray , Linus Walleij , Andrew Morton , Andy Shevchenko , Arnd Bergmann , Linux-Arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 3, 2020 at 6:32 PM Andy Shevchenko wrote: > > On Sat, Oct 3, 2020 at 3:56 PM William Breathitt Gray > wrote: > > On Sat, Oct 03, 2020 at 03:45:04PM +0300, Andy Shevchenko wrote: > > > On Sat, Oct 3, 2020 at 2:37 PM Syed Nayyar Waris wrote: > > > > On Sat, Oct 3, 2020 at 2:14 PM Andy Shevchenko > > > > wrote: > > > > > On Sat, Oct 3, 2020 at 2:51 AM Syed Nayyar Waris wrote: > > ... > > > > > > > + map[index] &= ~BITMAP_FIRST_WORD_MASK(start); > > > > > > + map[index] |= value << offset; > > > > > > Side note: I would prefer + 0 here and there, but it's up to you. Andy what do you mean by the above statement, can you please clarify? Can you please elaborate on the above statement. Thanks > > > > > > > > > + map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits); > > > > > > + map[index + 1] |= (value >> space); > > > > > > By the way, what about this in the case of start=0, nbits > 64? > > > space == 64 -> UB. > > > > > > (And btw parentheses are redundant here) > > > > I think this is the same situation as before: we should document that > > nbits must be between 1 and BITS_PER_LONG. > > At least documented, yes. > > -- > With Best Regards, > Andy Shevchenko