From: Sascha Hauer <s.hauer@pengutronix.de>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] log2: Fix declaration of __roundup_pow_of_two
Date: Wed, 27 Feb 2013 08:59:47 +0100 [thread overview]
Message-ID: <20130227075947.GF1906@pengutronix.de> (raw)
In-Reply-To: <1361897473-3325-1-git-send-email-maxime.ripard@free-electrons.com>
On Tue, Feb 26, 2013 at 05:51:13PM +0100, Maxime Ripard wrote:
> The roundup_pow_of_two function is making use of __roundup_pow_of_two
> when the call to __builtin_constant_p fails, which is not implemented in
> barebox.
>
> Copied the code from Linux log2.h header.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Applied, thanks
Sascha
> ---
> include/linux/log2.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/include/linux/log2.h b/include/linux/log2.h
> index 389043a..d9913f0 100644
> --- a/include/linux/log2.h
> +++ b/include/linux/log2.h
> @@ -54,6 +54,15 @@ bool is_power_of_2(unsigned long n)
> return (n != 0 && ((n & (n - 1)) == 0));
> }
>
> +/*
> + * round up to nearest power of two
> + */
> +static inline __attribute__((const))
> +unsigned long __roundup_pow_of_two(unsigned long n)
> +{
> + return 1UL << fls(n - 1);
> +}
> +
> /**
> * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value
> * @n - parameter
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-02-27 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-26 16:51 Maxime Ripard
2013-02-27 7:59 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130227075947.GF1906@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=maxime.ripard@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox