Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2028610pxk; Sat, 3 Oct 2020 06:06:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIpVL/FWkNC3KmfRg0Mh6Me49c7XhaG4kWeVLdZ2qMjQrGjfAMXdvLkfSbCc6TOEG4fcMl X-Received: by 2002:a17:906:556:: with SMTP id k22mr6383960eja.369.1601730391031; Sat, 03 Oct 2020 06:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601730391; cv=none; d=google.com; s=arc-20160816; b=gJNO5GwTDWYjotB0qdFiO0iKgJ8bCgLL5j8a+nzpWHbWvjrv9WxANlG4HzzxwA4TU0 exEAf3t5iaYjc2u5L77R6kbk1A216WgjRV2+vaD/BTmRtFIAgU7Buiuj/O6UrBVWK8gf KPwu/8+GeOIsAhh5Ko9YGtqIJUYTUtpBJAtQGSXkvjpMxkeecoDhKa6wrgtTu6YeSXdw y+y0xPhhfTGU0tugTmtAM25vZJDhXVjwz2mp4pNuUAnAMi77nFOtmfUlKr0lfV1Y7fRy ACaAgxY+2k5HBeabI5U4iM/f/W4kCOeMG2d9/2bVmHrfnUl5RGK5pRgmlPmBnhtOOqne ewxQ== 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=I5e/GWfMR/+SuunvSGOcvgPLoxHRm9LD0bTOHU6oHCk=; b=afDHNwb5EkV8L0kX1IDNkpq7lVxuT0aIXYKwaxsPij+9Zme/fWIrt48SIbOCmd1RYa 606spG3/9bxml+UXLO6Ong0seEzst9CtlazexRZpafMMogWShIrGrXc6wgSLzOQ06jEe vo3ATr+WKGrjFAYcRcGCQExWVKUMNCdEyxcro+KZToSr7biGqPn3j+3VHuKldfjizSym eGgxTVt/Hszw69E+iY2Jd1X3y0b4NZl90irzQDUihfuYOl/2YPaTd/K+lXNvKB1XP4QT dkBUmWWQXZlq4o9M7mqf/nqpiMJKqLjX1mM1DceQZX02oG3+XDmyVZGDngC96cvG6arc dHog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KhHrgLOt; 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 bu15si3235228ejb.548.2020.10.03.06.06.06; Sat, 03 Oct 2020 06:06:31 -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=KhHrgLOt; 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 S1725791AbgJCNDC (ORCPT + 99 others); Sat, 3 Oct 2020 09:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgJCNDA (ORCPT ); Sat, 3 Oct 2020 09:03:00 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7377C0613D0; Sat, 3 Oct 2020 06:02:58 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id e10so2838637pfj.1; Sat, 03 Oct 2020 06:02:58 -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=I5e/GWfMR/+SuunvSGOcvgPLoxHRm9LD0bTOHU6oHCk=; b=KhHrgLOt0wICgYy3TwMwJO14yTK7PmBdJAqdBPO3n82JRAIxJQmOMkB6A8Uv/S0l7m jyx1iCz1cody1muREz/WtEedjmHpS114Qcoehf8DseI0dj48AXb16P4ELeGSjorogo5F giQrRyXcCbYf0MnJoUusYQINRf7IJDD18UBBeNnUcXbn5bO/IuDCo4wKzjvtXSr+Y3Yt w99/tAb3bQhHPXLZe1HDYjq4DRqd3Ci49A+cJNg/WPCfsB0CVVaecUgLb7DNQWFGjruZ gvpS0k2AWNZs4XvhsgHzx0l23c93WRhlQ0vE64Ps6P4OpHDcVEOsXSFkeslmiwjdpV8B y3TQ== 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=I5e/GWfMR/+SuunvSGOcvgPLoxHRm9LD0bTOHU6oHCk=; b=TXWyMfekuoPTyOMXSBRIyL2vLBy6xGVeoGVHC44wt4BgIHFUWCy2hvRCyML0xYwMkC doHQ8Kapm96VjrmCYTIBiJ3QfdejHs6hkK22WJNYM723EDSr22Ksmo1OnhecKd76p17T AtbamUmJTNvsSlpQQfsoJbxtdy3R4WB6y+k1H1HaMoJOLLP7vi/qAHOu13DTgF9kSKko wfHeBBbJftjpD5GPHzPn9b7AEv5ZSwFYJKBj+gXZLW5LB7Z1mc94cYqgNx55qQCn0mAX lidrU2g+8mZw384rMxl31h2Ebdnj0hUCBEJZutyf1jwX05FDJjs2RC13GD2IoutH8wCf A/Rw== X-Gm-Message-State: AOAM531qerAHc8T3osfOm6NMVw74NM5JlCCLuxmmZ9qP39ThJSpyjdGb UcGJAoqjLRjIQrCYFdFpwXTtgc0BQYwnMffFpvQ= X-Received: by 2002:a63:4c1d:: with SMTP id z29mr6614962pga.203.1601730178122; Sat, 03 Oct 2020 06:02:58 -0700 (PDT) MIME-Version: 1.0 References: <20201003125626.GA3732@shinobu> In-Reply-To: <20201003125626.GA3732@shinobu> From: Andy Shevchenko Date: Sat, 3 Oct 2020 16:02:41 +0300 Message-ID: Subject: Re: [PATCH v10 1/4] bitops: Introduce the for_each_set_clump macro To: William Breathitt Gray Cc: Syed Nayyar Waris , 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 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. > > > > > > > + 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