qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 21/39] ivshmem: use common is_power_of_2()


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH 21/39] ivshmem: use common is_power_of_2()
Date: Fri, 26 Jun 2015 16:49:27 +0200

The common version correctly checks for 0 value case.

Signed-off-by: Marc-André Lureau <address@hidden>
---
 hw/misc/ivshmem.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 8fcdd60..34da11a 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)
 {
@@ -631,7 +627,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;
     }
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]