From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOs3Y-0008JX-Ew for qemu-devel@nongnu.org; Fri, 20 Feb 2015 13:12:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOs3U-0005Ku-8C for qemu-devel@nongnu.org; Fri, 20 Feb 2015 13:12:04 -0500 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:60099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOs3U-0005Km-38 for qemu-devel@nongnu.org; Fri, 20 Feb 2015 13:12:00 -0500 Received: by mail-qa0-f43.google.com with SMTP id bm13so13665299qab.2 for ; Fri, 20 Feb 2015 10:11:59 -0800 (PST) Sender: Richard Henderson Message-ID: <54E778EB.5050301@twiddle.net> Date: Fri, 20 Feb 2015 10:11:55 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1424183053-4310-1-git-send-email-mimu@linux.vnet.ibm.com> <1424183053-4310-11-git-send-email-mimu@linux.vnet.ibm.com> In-Reply-To: <1424183053-4310-11-git-send-email-mimu@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class initialization routines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Mueller , qemu-devel@nongnu.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Gleb Natapov , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , Cornelia Huck , Paolo Bonzini , Andreas Faerber On 02/17/2015 06:24 AM, Michael Mueller wrote: > +static inline uint64_t big_endian_bit(unsigned long nr) > +{ > + return 1ul << (BITS_PER_LONG - (nr % BITS_PER_LONG)); > +}; This is buggy. NR=0 should map to 63, not 64. > + return !!(*ptr & big_endian_bit(nr)); Personally I dislike !! as an idiom. Given that big_endian_bit isn't used anywhere else, can we integrate it and change this to static inline int test_facility(unsigned long nr, uint64_t *fac_list) { unsigned long word = nr / BITS_PER_LONG; unsigned long be_bit = 63 - (nr % BITS_PER_LONG); return (fac_list[word] >> be_bit) & 1; } r~