Message ID | 1481512100-10380-4-git-send-email-peterx@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/lib/libcflat.h b/lib/libcflat.h index c622198..8455c3d 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -104,4 +104,9 @@ do { \ } \ } while (0) +static inline bool is_power_of_2(unsigned long n) +{ + return n && !(n & (n - 1)); +} + #endif