Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247AbbBTSMD (ORCPT ); Fri, 20 Feb 2015 13:12:03 -0500 Received: from mail-qc0-f172.google.com ([209.85.216.172]:38692 "EHLO mail-qc0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbbBTSMA (ORCPT ); Fri, 20 Feb 2015 13:12:00 -0500 Message-ID: <54E778EB.5050301@twiddle.net> Date: Fri, 20 Feb 2015 10:11:55 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 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 Subject: Re: [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class initialization routines 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 863 Lines: 27 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~ -- 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/