Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2219499imm; Sat, 16 Jun 2018 12:18:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ4th+OgwdHfySvIXtKv/kuP+Xv1ByKlPtRTuv430HlHnqGUp1amxJYnJHNWj6G2e/p7Yh5 X-Received: by 2002:aa7:81d3:: with SMTP id c19-v6mr7332777pfn.224.1529176690847; Sat, 16 Jun 2018 12:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529176690; cv=none; d=google.com; s=arc-20160816; b=SJQm9JmVTBPXwztynzGO9MD7jNaebsVn4FWsPkQwfE7mscqixdmS3DaebJH07jMHob SQCRHsuutlmKZ0q9+f+7vIc0BF8q5+fZuT5TnuJQel+ko07aq9fT6R0H796mR+FcYQGV yqdLINTOecBZG4B866jaDrcQW3rmOdSN1R9GwXt+QqSMsIhXzXe3vEX0f7laLqw/CvBs ZV0BuHEKZfDhSMop1mMq0slDxWKFm9fWPDP5a6xAjkkwupFlOSIkEHSXMI3Qf9rSkDdR tmti8M9oTP5+E00P4f0v78bh2U5eioGqDL7kKR7nGiwkly6oMm5rV8rTlVJ3kcSV+ws2 XTVQ== 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:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Y4fYWdt8qcDdRJRxF6ANwncTVvA5v54Ksolkx660k4c=; b=q0L7kBuhlfExhqNPKXZaexhAIG3hqgfGZpUICzkTNbX2kpUXhEkQAdOB4Cw2CCq/Ky omsVGd+iIo51bDdv1fjEyYdTiyuDatpvvRDrEfNi9kZeMT3SaGQXAeCOs0RjnRislUgC rHAqId+/rkL8MQ/vsYyzP5sIh5jqeQGAg98ymDfRHFHpyleiKKMJ2lj6szNlRV4zuijh UEG4TmhbC1MhbnvvMJUIe1yM/aavhaUGf5/LgGLvbikb8YQyy39tSJ9ctumHbheJ5zZA 3Jefb/jdo/FGCQwj9x/cRBFo3F8FnRHPD3XZIvEBwJtOg0WC56GK/NhI/KRgU15qd2Pu cG0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hre85pPR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si10692447pld.424.2018.06.16.12.17.29; Sat, 16 Jun 2018 12:18:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hre85pPR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933047AbeFPTQk (ORCPT + 99 others); Sat, 16 Jun 2018 15:16:40 -0400 Received: from mail-yb0-f193.google.com ([209.85.213.193]:45423 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932542AbeFPTQg (ORCPT ); Sat, 16 Jun 2018 15:16:36 -0400 Received: by mail-yb0-f193.google.com with SMTP id x6-v6so4655958ybl.12; Sat, 16 Jun 2018 12:16:36 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Y4fYWdt8qcDdRJRxF6ANwncTVvA5v54Ksolkx660k4c=; b=hre85pPRct45yC9YIXqETBQ46v3pz4jNuR7QC9eLIy/Mby1T8fmZitC7+p2ZuSew0K m+eZyP7C7ga76YVUHtRUJXocBZR9Z2dCTXcjmN2wHWL7pDoWnRUKvpLPdGnDqbRbGUk6 RMgqANGbH8CjAcn7rDt51G6QZfM7mCfEtOoH/+bawYlWgtymcyxuKy4F/5SNXggHdI23 iVwasaPfCLPzqzoZTtafcFkA5dTqTu/M+Irmw+pKx+GQklkc2tobxMYvbU3vCZj2sC2t bDUY8b1ZLmhSVaz9UucOVbvnzdpqK4O7RiozC5Kx2LHIbJAtwtbEp5zahIg8LLMOpMDJ 1+dg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Y4fYWdt8qcDdRJRxF6ANwncTVvA5v54Ksolkx660k4c=; b=ZPf4+w3H1x6T1zXQNaAgF42saB3kUqxHAk7MTL4fbs8/Y5xs5pQHWxBTygDR0YBsNb YJPirXWKkM++T8hZ28c+212RqtLB/elGPj6VT8M0/D6Z7/47eed8ysp9ZUqu5bzjtsyv ra1C4xb1FS4NGrvvh6T+T2lVffuWkumiT5Zlhnh8VsJSNMVN9xpfrxTphyMI0ToThiX8 5sfjAmeifn16jD6GmjfjHHv+Ju2sk24Wa671VFhSR1zeQAq58v5XEJT59xB88WIexh89 1j3ybXJ6YlMy44W5Mvq9/YQKnNe3fvzexCAZXl0XJf1rpW1eZ4PlC/6S/k9kDQdvBGlx msFg== X-Gm-Message-State: APt69E1zZhwf+GrYGAPIOqxAMrn4I9v1HdavD9k+NH3tdm24CMjnYOG6 3EK7liZmGRDV1f5fR1YOCsk= X-Received: by 2002:a25:d4c1:: with SMTP id m184-v6mr965741ybf.244.1529176595578; Sat, 16 Jun 2018 12:16:35 -0700 (PDT) Received: from sophia ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id w4-v6sm3951742ywf.63.2018.06.16.12.16.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Jun 2018 12:16:34 -0700 (PDT) Date: Sat, 16 Jun 2018 15:16:24 -0400 From: William Breathitt Gray To: Andy Shevchenko Cc: Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux-Arch , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4 0/8] Introduce the for_each_set_clump macro Message-ID: <20180616191624.GA20211@sophia> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 16, 2018 at 11:08:28PM +0300, Andy Shevchenko wrote: >On Wed, May 16, 2018 at 5:03 PM, Linus Walleij wrote: >> On Tue, May 15, 2018 at 6:22 PM, William Breathitt Gray >> wrote: >> >>> For example, suppose you would like to iterate over a 16-bit integer 4 >>> bits at a time, skipping over 4-bit groups with no set bit, where XXXX >>> represents the current 4-bit group: >>> >>> Example: 1011 1110 0000 1111 >>> First loop: 1011 1110 0000 XXXX >>> Second loop: 1011 XXXX 0000 1111 >>> Third loop: XXXX 1110 0000 1111 >>> >>> Each iteration of the loop returns the next 4-bit group that has at >>> least one set bit. >>> >>> The for_each_set_clump macro has six parameters: >>> >>> * clump: set to current clump index for the iteration >>> * index: set to current bitmap word index for the iteration >>> * offset: bits offset of the found clump in the bitmap word >>> * bits: bitmap to search within >>> * size: bitmap size in number of clumps >>> * clump_size: clump size in number of bits >>> >>> The clump_size argument can be an arbitrary number of bits and is not >>> required to be a multiple of 2. >> >> I must say I'm impressed. Very nice arithmetics going on there. >> >> If I can get some ACK for the bitops patch I'd be happy to merge >> it all through the GPIO tree. The users are pretty clear cut. > >Give me also some time to go through proposed API, I think it might >have needed more alignment with existing find_* and for_* helpers. Hi Andy, Are there any additional changes you would like me to make before this patchset is merged through the GPIO tree? William Breathitt Gray > >> BTW: if I could, I would pull out Donald Knuth's "The Art of Computer >> Programming vol 4A" chapter 7.1.3 "Bitwise Tricks and Techniques" >> to see what he has to say about the subject, but I don't have >> that book as it turns out. > >I can also add the Standford collection of bit algos here: > >https://graphics.stanford.edu/~seander/bithacks.html > >-- >With Best Regards, >Andy Shevchenko