Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755785AbXKFSOb (ORCPT ); Tue, 6 Nov 2007 13:14:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754321AbXKFSOY (ORCPT ); Tue, 6 Nov 2007 13:14:24 -0500 Received: from gw-colo-pa.panasas.com ([66.238.117.130]:22638 "EHLO cassoulet.panasas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754178AbXKFSOX (ORCPT ); Tue, 6 Nov 2007 13:14:23 -0500 Message-ID: <4730AE66.6030501@panasas.com> Date: Tue, 06 Nov 2007 20:11:50 +0200 From: Boaz Harrosh User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: "Robert P. J. Day" CC: Linux Kernel Mailing List , Andrew Morton , matthew@wil.cx Subject: Re: [PATCH] Add the macro to test if "exactly_one_bit_set" to log2.h. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Nov 2007 18:11:53.0409 (UTC) FILETIME=[825DA310:01C820A0] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1060 Lines: 35 On Tue, Nov 06 2007 at 18:38 +0200, "Robert P. J. Day" wrote: > While this macro is defined in terms of "is_power_of_2" and is > therefore functionally equivalent, the visual semantics are sometimes > more appropriate for what is actually being tested. > > Signed-off-by: Robert P. J. Day > > --- > > diff --git a/include/linux/log2.h b/include/linux/log2.h > index c8cf5e8..d0d324e 100644 > --- a/include/linux/log2.h > +++ b/include/linux/log2.h > @@ -55,6 +55,12 @@ bool is_power_of_2(unsigned long n) > } > > /* > + * And for folks who want slightly different semantics ... > + */ > + > +#define exactly_one_bit_set is_power_of_2 at_most_one_bit_set No? > + > +/* > * round up to nearest power of two > */ > static inline __attribute__((const)) Boaz - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/