Commit 0d0bc38e authored by Peter Xu's avatar Peter Xu Committed by Paolo Bonzini
Browse files

libcflat: introduce is_power_of_2()


Suggested-by: Andrew Jones's avatarAndrew Jones <drjones@redhat.com>
Reviewed-by: Andrew Jones's avatarAndrew Jones <drjones@redhat.com>
Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent d77d128f
......@@ -111,4 +111,9 @@ do { \
} \
} while (0)
static inline bool is_power_of_2(unsigned long n)
{
return n && !(n & (n - 1));
}
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment