diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2015-06-18 16:10:33 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2015-10-24 18:02:49 +0200 |
commit | e309366337d636689730f6484e388e46db7b5654 (patch) | |
tree | 4fb0f025e32992a29a7324e8c586fa90bd32035d | |
parent | 6f8a16d55daac5657ccbcf953140685048e15ace (diff) | |
download | qemu-e309366337d636689730f6484e388e46db7b5654.zip qemu-e309366337d636689730f6484e388e46db7b5654.tar.gz qemu-e309366337d636689730f6484e388e46db7b5654.tar.bz2 |
ivshmem: use common is_power_of_2()
The common version correctly checks for 0 value case.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
-rw-r--r-- | hw/misc/ivshmem.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index fbb6f40..e678b18 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -117,10 +117,6 @@ static inline uint32_t ivshmem_has_feature(IVShmemState *ivs, return (ivs->features & (1 << feature)); } -static inline bool is_power_of_two(uint64_t x) { - return (x & (x - 1)) == 0; -} - /* accessing registers - based on rtl8139 */ static void ivshmem_update_irq(IVShmemState *s) { @@ -632,7 +628,7 @@ static uint64_t ivshmem_get_size(IVShmemState * s, Error **errp) { } /* BARs must be a power of 2 */ - if (!is_power_of_two(value)) { + if (!is_power_of_2(value)) { error_setg(errp, "size must be power of 2"); return 0; } |