Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933661AbbBDMA1 (ORCPT ); Wed, 4 Feb 2015 07:00:27 -0500 Received: from smtp-out6.electric.net ([192.162.217.187]:51010 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932316AbbBDMAY (ORCPT ); Wed, 4 Feb 2015 07:00:24 -0500 From: David Laight To: "'Chen Gang S'" , "marcel@holtmann.org" , "gustavo@padovan.org" , "johan.hedberg@gmail.com" CC: "David S. Miller" , "linux-bluetooth@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2] net: bluetooth: hci_sock: Use 'const void *' instead of 'void *' for 2nd parameter of hci_test_bit() Thread-Topic: [PATCH v2] net: bluetooth: hci_sock: Use 'const void *' instead of 'void *' for 2nd parameter of hci_test_bit() Thread-Index: AQHQPywzeR6i5TQh3kGdfi5IMQnXPJzgZU2A Date: Wed, 4 Feb 2015 11:59:39 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CADA5E1@AcuExch.aculab.com> References: <54CFE8BE.5030700@sunrus.com.cn> In-Reply-To: <54CFE8BE.5030700@sunrus.com.cn> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t14C0Vo6017316 Content-Length: 571 Lines: 14 From: Chen Gang S > -static inline int hci_test_bit(int nr, void *addr) > +static inline int hci_test_bit(int nr, const void *addr) > { > return *((__u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); > } Is there a 'standard' function lurking that will do the above. On x86 the cpus 'bit test' instruction will handle bit numbers greater than the word size - so it can be a single instruction. David ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?