[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 01/15] bitops: Add MAKE_64BIT_MASK macro
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH v5 01/15] bitops: Add MAKE_64BIT_MASK macro |
Date: |
Tue, 22 Mar 2016 15:26:46 +0000 |
User-agent: |
mu4e 0.9.17; emacs 25.0.92.7 |
Alistair Francis <address@hidden> writes:
> Add a macro that creates a 64bit value which has length number of ones
> shifted acrros by the value of shift.
>
> Signed-off-by: Alistair Francis <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
> ---
> V5:
> - Re-write to a 64-bit mask instead of ONES()
> - Re-order this patch in the series
>
> include/qemu/bitops.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
> index 755fdd1..3c45791 100644
> --- a/include/qemu/bitops.h
> +++ b/include/qemu/bitops.h
> @@ -24,6 +24,9 @@
> #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
> #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE *
> sizeof(long))
>
> +#define MAKE_64BIT_MASK(shift, length) \
> + (((1ull << (length)) - 1) << shift)
> +
> /**
> * set_bit - Set a bit in memory
> * @nr: the bit to set
--
Alex Bennée
- [Qemu-devel] [PATCH v5 00/15] data-driven device registers, Alistair Francis, 2016/03/08
- [Qemu-devel] [PATCH v5 01/15] bitops: Add MAKE_64BIT_MASK macro, Alistair Francis, 2016/03/08
- Re: [Qemu-devel] [PATCH v5 01/15] bitops: Add MAKE_64BIT_MASK macro,
Alex Bennée <=
- [Qemu-devel] [PATCH v5 02/15] register: Add Register API, Alistair Francis, 2016/03/08
- [Qemu-devel] [PATCH v5 03/15] register: Add Memory API glue, Alistair Francis, 2016/03/08
- [Qemu-devel] [PATCH v5 04/15] register: Add support for decoding information, Alistair Francis, 2016/03/08
- [Qemu-devel] [PATCH v5 05/15] register: Define REG and FIELD macros, Alistair Francis, 2016/03/08
- [Qemu-devel] [PATCH v5 06/15] register: QOMify, Alistair Francis, 2016/03/08