Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756786AbZF2SPX (ORCPT ); Mon, 29 Jun 2009 14:15:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754313AbZF2SPK (ORCPT ); Mon, 29 Jun 2009 14:15:10 -0400 Received: from cantor.suse.de ([195.135.220.2]:33101 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753888AbZF2SPJ (ORCPT ); Mon, 29 Jun 2009 14:15:09 -0400 Subject: Re: [PATCH] Introduce a boolean "single_bit_set" function. From: Petr Tesarik To: Andrew Morton Cc: "Robert P. J. Day" , David Daney , Linux Kernel Mailing List In-Reply-To: <20090424104651.7c751735.akpm@linux-foundation.org> References: <49F0C817.8050407@caviumnetworks.com> <20090423165723.16c9f566.akpm@linux-foundation.org> <20090424104651.7c751735.akpm@linux-foundation.org> Content-Type: text/plain; charset="UTF-8" Organization: SUSE LINUX Date: Mon, 29 Jun 2009 20:15:11 +0200 Message-Id: <1246299311.7698.19.camel@nathan.suse.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1.1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1088 Lines: 34 Andrew Morton píše v Pá 24. 04. 2009 v 10:46 -0700: > On Fri, 24 Apr 2009 06:40:39 -0400 (EDT) "Robert P. J. Day" wrote: > > > so it would be a simple matter to define the bit set boolean in > > terms of hweight_long(), yes? so what about, in bitops.h: > > > > static inline bool > > exactly_one_bit_set(unsigned long w) > > { > > return hweight_long(w) == 1; > > } > > > > static inline bool > > more_than_one_bit_set(unsigned long w) > > { > > return hweight_long(w) > 1; > > } > > Andrew, you must be kidding! Are you seriously suggesting to replace a simple and instruction with a call to an extern library function with 17 instructions (not including the call and ret)? I'd better check the use of hweight in the kernel to eradicate as many calls to it as possible... Petr Tesarik -- 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/