From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson Subject: Re: [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class initialization routines Date: Fri, 20 Feb 2015 10:11:55 -0800 Message-ID: <54E778EB.5050301@twiddle.net> References: <1424183053-4310-1-git-send-email-mimu@linux.vnet.ibm.com> <1424183053-4310-11-git-send-email-mimu@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , Cornelia Huck , Paolo Bonzini , Andreas Faerber To: Michael Mueller , qemu-devel@nongnu.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Return-path: In-Reply-To: <1424183053-4310-11-git-send-email-mimu@linux.vnet.ibm.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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~