Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161540AbbBDUNh (ORCPT ); Wed, 4 Feb 2015 15:13:37 -0500 Received: from mail-la0-f41.google.com ([209.85.215.41]:38793 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934091AbbBDUNd (ORCPT ); Wed, 4 Feb 2015 15:13:33 -0500 Message-ID: <54D27D68.7040501@cogentembedded.com> Date: Wed, 04 Feb 2015 23:13:28 +0300 From: Sergei Shtylyov Organization: Cogent Embedded User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: David Laight , "'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() References: <54CFE8BE.5030700@sunrus.com.cn> <063D6719AE5E284EB5DD2968C1650D6D1CADA5E1@AcuExch.aculab.com> In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CADA5E1@AcuExch.aculab.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 756 Lines: 25 Hello. On 02/04/2015 02:59 PM, David Laight wrote: >> -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. Of course, there's test_bit(). > David WBR, Sergei -- 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/