From: Andrew Jones Subject: Re: [PATCH kvm-unit-tests v2 02/17] libcflat: introduce is_power_of_2() Date: Thu, 10 Nov 2016 19:20:00 +0100 Message-ID: <20161110182000.445ysavw7x2db4es@hawk.localdomain> References: <1478704224-20472-1-git-send-email-peterx@redhat.com> <1478704224-20472-3-git-send-email-peterx@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, rkrcmar@redhat.com, agordeev@redhat.com, jan.kiszka@web.de, pbonzini@redhat.com To: Peter Xu Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41614 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754703AbcKJSUG (ORCPT ); Thu, 10 Nov 2016 13:20:06 -0500 Content-Disposition: inline In-Reply-To: <1478704224-20472-3-git-send-email-peterx@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Nov 09, 2016 at 10:10:09AM -0500, Peter Xu wrote: > Suggested-by: Andrew Jones > Signed-off-by: Peter Xu > --- > lib/libcflat.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/lib/libcflat.h b/lib/libcflat.h > index 72b1bf9..19bd0c6 100644 > --- a/lib/libcflat.h > +++ b/lib/libcflat.h > @@ -103,4 +103,9 @@ do { \ > } \ > } while (0) > > +static inline bool is_power_of_2(unsigned long n) > +{ > + return (n && !(n & (n - 1))); nit: outer () are unnecessary > +} > + > #endif Reviewed-by: Andrew Jones