]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
ivshmem: use common is_power_of_2()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 18 Jun 2015 14:10:33 +0000 (16:10 +0200)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Sat, 24 Oct 2015 16:02:49 +0000 (18:02 +0200)
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>
hw/misc/ivshmem.c

index fbb6f407ec904731a0c3531bded6c6c1748b8a2d..e678b186dde155bf732cc8f997ef3400d63ca604 100644 (file)
@@ -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;
     }