qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC PATCH v5 07/14] bitops: Add ONES macro


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH v5 07/14] bitops: Add ONES macro
Date: Mon, 27 Apr 2015 14:58:02 -0700

Little macro that just gives you N ones (justified to LSB).

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 include/qemu/bitops.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
index 90ca8df..30bad78 100644
--- a/include/qemu/bitops.h
+++ b/include/qemu/bitops.h
@@ -415,4 +415,6 @@ static inline uint64_t deposit64(uint64_t value, int start, 
int length,
     return (value & ~mask) | ((fieldval << start) & mask);
 }
 
+#define ONES(num) ((num) == 64 ? ~0ull : (1ull << (num)) - 1)
+
 #endif
-- 
2.3.6.3.g2cc70ee




reply via email to

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