From: "Jan Beulich" Subject: Re: [RFC PATCH v3 02/18] xen: Add log2 functionality Date: Mon, 22 Jun 2015 14:17:45 +0100 Message-ID: <55882719020000780008792E@mail.emea.novell.com> References: <1434974517-12136-1-git-send-email-vijay.kilari@gmail.com> <1434974517-12136-3-git-send-email-vijay.kilari@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1434974517-12136-3-git-send-email-vijay.kilari@gmail.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: vijay.kilari@gmail.com Cc: Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, Prasun.Kapoor@caviumnetworks.com, manish.jaggi@caviumnetworks.com, tim@xen.org, xen-devel@lists.xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, Vijaya Kumar K List-Id: xen-devel@lists.xenproject.org >>> On 22.06.15 at 14:01, wrote: First of all, please Cc _all_ relevant maintainers. > --- a/xen/include/xen/bitops.h > +++ b/xen/include/xen/bitops.h > @@ -117,6 +117,14 @@ static inline int generic_fls64(__u64 x) > # endif > #endif > > +static inline unsigned fls_long(unsigned long l) > +{ > + if (sizeof(l) == 4) > + return fls(l); > + > + return fls64(l); > +} I'm not really opposed to this, but did you really verify that there's no suitable functionality in tree already (even if named differently)? I can't, e.g., see why flsl() wouldn't fit your needs. > --- /dev/null > +++ b/xen/include/xen/log2.h > @@ -0,0 +1,205 @@ > +/* > + * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. > + * Written by David Howells (dhowells@redhat.com) > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > + > +#ifndef _LINUX_LOG2_H > +#define _LINUX_LOG2_H LINUX? > +/* > + * deal with unrepresentable constant logarithms > + */ > +extern __attribute__((const)) > +int ____ilog2_NaN(void); -ETOOMANYUNDERSCORES > +#if 1 ??? (at least one more below) Also, are you really needing all of what you add here? Jan