aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/bitops.h
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@xilinx.com>2016-07-04 13:06:36 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-07-04 13:15:22 +0100
commitae2923b5c20a21c6457680330506a9c13873485c (patch)
tree4f8a8e5e6cd6dde4a72a048395f0f9cabc452424 /include/qemu/bitops.h
parent5d636e21c44ecf982a22a7bc4ca89186079ac283 (diff)
downloadqemu-ae2923b5c20a21c6457680330506a9c13873485c.zip
qemu-ae2923b5c20a21c6457680330506a9c13873485c.tar.gz
qemu-ae2923b5c20a21c6457680330506a9c13873485c.tar.bz2
bitops: Add MAKE_64BIT_MASK macro
Add a macro that creates a 64bit value which has length number of ones shifted across by the value of shift. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 9773244aa1c8c26b8b82cb261d8f5dd4b7b9fcf9.1467053537.git.alistair.francis@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/qemu/bitops.h')
-rw-r--r--include/qemu/bitops.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
index 15418a8..98fb005 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) \
+ (((~0ULL) >> (64 - (length))) << (shift))
+
/**
* set_bit - Set a bit in memory
* @nr: the bit to set