From: Peter Maydell <peter.maydell@linaro.org>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: blauwirbel@gmail.com, edgar.iglesias@gmail.com,
kraxel@redhat.com, qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/5] bitops: Add ONES macro
Date: Fri, 5 Apr 2013 09:53:42 +0100 [thread overview]
Message-ID: <CAFEAcA_0DwVMLPokEw1vfAjPc6pMXLsq66oAUSZENce7Wt5gOg@mail.gmail.com> (raw)
In-Reply-To: <b956c896f5581a9ee1c2cf97f7fb9ac84bb67455.1365151096.git.peter.crosthwaite@xilinx.com>
On 5 April 2013 09:43, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> Little macro that just gives you N ones (justified to LSB).
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
> include/qemu/bitops.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
> index affcc96..da47fc8 100644
> --- a/include/qemu/bitops.h
> +++ b/include/qemu/bitops.h
> @@ -273,4 +273,6 @@ static inline uint64_t deposit64(uint64_t value, int start, int length,
> return (value & ~mask) | ((fieldval << start) & mask);
> }
>
> +#define ONES(num) ((num) == 64 ? ~0ull : (1ull << (num)) - 1)
You can avoid the ?: here (assuming you're happy to say that
ONES(0) is a silly thing to ask for):
#define ONES(num) (~0ULL >> (64 - (num)))
Needs a documentation comment, anyway.
thanks
-- PMM
next prev parent reply other threads:[~2013-04-05 8:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-05 8:43 [Qemu-devel] [PATCH v2 0/5] Data Driven device registers & Zynq DEVCFG Peter Crosthwaite
2013-04-05 8:43 ` [Qemu-devel] [PATCH v2 1/5] bitops: Add ONES macro Peter Crosthwaite
2013-04-05 8:53 ` Peter Maydell [this message]
2013-04-05 9:11 ` Peter Crosthwaite
2013-04-05 9:24 ` Peter Maydell
2013-04-05 8:43 ` [Qemu-devel] [PATCH v2 2/5] register: Add Register API Peter Crosthwaite
2013-04-05 9:26 ` Peter Maydell
2013-04-05 9:49 ` Peter Crosthwaite
2013-04-07 22:40 ` Peter Crosthwaite
2013-04-15 7:11 ` Gerd Hoffmann
2013-04-05 8:43 ` [Qemu-devel] [PATCH v2 3/5] register: Add Memory API glue Peter Crosthwaite
2013-04-05 10:07 ` Paolo Bonzini
2013-04-05 8:43 ` [Qemu-devel] [PATCH v2 4/5] xilinx_devcfg: Zynq devcfg device model Peter Crosthwaite
2013-04-05 8:43 ` [Qemu-devel] [PATCH v2 5/5] xilinx_zynq: added devcfg to machine model Peter Crosthwaite
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=CAFEAcA_0DwVMLPokEw1vfAjPc6pMXLsq66oAUSZENce7Wt5gOg@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=blauwirbel@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).